Commit 364aeb2849789b51bf4b9af2ddd02fee7285c54e

Authored by David Rientjes
Committed by Linus Torvalds
1 parent 58a01a4572

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: Peter Zijlstra <peterz@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 16 additions and 16 deletions Side-by-side Diff

include/linux/writeback.h
... ... @@ -125,8 +125,8 @@
125 125 int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
126 126 void __user *, size_t *, loff_t *);
127 127  
128   -void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
129   - struct backing_dev_info *bdi);
  128 +void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
  129 + unsigned long *pbdi_dirty, struct backing_dev_info *bdi);
130 130  
131 131 void page_writeback_init(void);
132 132 void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
... ... @@ -24,9 +24,9 @@
24 24 static int bdi_debug_stats_show(struct seq_file *m, void *v)
25 25 {
26 26 struct backing_dev_info *bdi = m->private;
27   - long background_thresh;
28   - long dirty_thresh;
29   - long bdi_thresh;
  27 + unsigned long background_thresh;
  28 + unsigned long dirty_thresh;
  29 + unsigned long bdi_thresh;
30 30  
31 31 get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi);
32 32  
... ... @@ -362,13 +362,13 @@
362 362 }
363 363  
364 364 void
365   -get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty,
366   - struct backing_dev_info *bdi)
  365 +get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
  366 + unsigned long *pbdi_dirty, struct backing_dev_info *bdi)
367 367 {
368 368 int background_ratio; /* Percentages */
369 369 int dirty_ratio;
370   - long background;
371   - long dirty;
  370 + unsigned long background;
  371 + unsigned long dirty;
372 372 unsigned long available_memory = determine_dirtyable_memory();
373 373 struct task_struct *tsk;
374 374  
... ... @@ -423,9 +423,9 @@
423 423 {
424 424 long nr_reclaimable, bdi_nr_reclaimable;
425 425 long nr_writeback, bdi_nr_writeback;
426   - long background_thresh;
427   - long dirty_thresh;
428   - long bdi_thresh;
  426 + unsigned long background_thresh;
  427 + unsigned long dirty_thresh;
  428 + unsigned long bdi_thresh;
429 429 unsigned long pages_written = 0;
430 430 unsigned long write_chunk = sync_writeback_pages();
431 431  
... ... @@ -580,8 +580,8 @@
580 580  
581 581 void throttle_vm_writeout(gfp_t gfp_mask)
582 582 {
583   - long background_thresh;
584   - long dirty_thresh;
  583 + unsigned long background_thresh;
  584 + unsigned long dirty_thresh;
585 585  
586 586 for ( ; ; ) {
587 587 get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
... ... @@ -624,8 +624,8 @@
624 624 };
625 625  
626 626 for ( ; ; ) {
627   - long background_thresh;
628   - long dirty_thresh;
  627 + unsigned long background_thresh;
  628 + unsigned long dirty_thresh;
629 629  
630 630 get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
631 631 if (global_page_state(NR_FILE_DIRTY) +