Commit 364aeb28 authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds

mm: change dirty limit type specifiers to unsigned long

The background dirty and dirty limits are better defined with type
specifiers of unsigned long since negative writeback thresholds are not
possible.

These values, as returned by get_dirty_limits(), are normally compared
with ZVC values to determine whether writeback shall commence or be
throttled.  Such page counts cannot be negative, so declaring the page
limits as signed is unnecessary.
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58a01a45
...@@ -125,8 +125,8 @@ struct file; ...@@ -125,8 +125,8 @@ struct file;
int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
void __user *, size_t *, loff_t *); void __user *, size_t *, loff_t *);
void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
struct backing_dev_info *bdi); unsigned long *pbdi_dirty, struct backing_dev_info *bdi);
void page_writeback_init(void); void page_writeback_init(void);
void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
......
...@@ -24,9 +24,9 @@ static void bdi_debug_init(void) ...@@ -24,9 +24,9 @@ static void bdi_debug_init(void)
static int bdi_debug_stats_show(struct seq_file *m, void *v) static int bdi_debug_stats_show(struct seq_file *m, void *v)
{ {
struct backing_dev_info *bdi = m->private; struct backing_dev_info *bdi = m->private;
long background_thresh; unsigned long background_thresh;
long dirty_thresh; unsigned long dirty_thresh;
long bdi_thresh; unsigned long bdi_thresh;
get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi); get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi);
......
...@@ -362,13 +362,13 @@ unsigned long determine_dirtyable_memory(void) ...@@ -362,13 +362,13 @@ unsigned long determine_dirtyable_memory(void)
} }
void void
get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
struct backing_dev_info *bdi) unsigned long *pbdi_dirty, struct backing_dev_info *bdi)
{ {
int background_ratio; /* Percentages */ int background_ratio; /* Percentages */
int dirty_ratio; int dirty_ratio;
long background; unsigned long background;
long dirty; unsigned long dirty;
unsigned long available_memory = determine_dirtyable_memory(); unsigned long available_memory = determine_dirtyable_memory();
struct task_struct *tsk; struct task_struct *tsk;
...@@ -423,9 +423,9 @@ static void balance_dirty_pages(struct address_space *mapping) ...@@ -423,9 +423,9 @@ static void balance_dirty_pages(struct address_space *mapping)
{ {
long nr_reclaimable, bdi_nr_reclaimable; long nr_reclaimable, bdi_nr_reclaimable;
long nr_writeback, bdi_nr_writeback; long nr_writeback, bdi_nr_writeback;
long background_thresh; unsigned long background_thresh;
long dirty_thresh; unsigned long dirty_thresh;
long bdi_thresh; unsigned long bdi_thresh;
unsigned long pages_written = 0; unsigned long pages_written = 0;
unsigned long write_chunk = sync_writeback_pages(); unsigned long write_chunk = sync_writeback_pages();
...@@ -580,8 +580,8 @@ EXPORT_SYMBOL(balance_dirty_pages_ratelimited_nr); ...@@ -580,8 +580,8 @@ EXPORT_SYMBOL(balance_dirty_pages_ratelimited_nr);
void throttle_vm_writeout(gfp_t gfp_mask) void throttle_vm_writeout(gfp_t gfp_mask)
{ {
long background_thresh; unsigned long background_thresh;
long dirty_thresh; unsigned long dirty_thresh;
for ( ; ; ) { for ( ; ; ) {
get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL); get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
...@@ -624,8 +624,8 @@ static void background_writeout(unsigned long _min_pages) ...@@ -624,8 +624,8 @@ static void background_writeout(unsigned long _min_pages)
}; };
for ( ; ; ) { for ( ; ; ) {
long background_thresh; unsigned long background_thresh;
long dirty_thresh; unsigned long dirty_thresh;
get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL); get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
if (global_page_state(NR_FILE_DIRTY) + if (global_page_state(NR_FILE_DIRTY) +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment