Skip to content

Commit 364aeb2

Browse files
rientjestorvalds
authored andcommitted
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>
1 parent 58a01a4 commit 364aeb2

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎include/linux/writeback.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ struct file;
125125
int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
126126
void __user *, size_t *, loff_t *);
127127

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);
130130

131131
void page_writeback_init(void);
132132
void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,

‎mm/backing-dev.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ static void bdi_debug_init(void)
2424
static int bdi_debug_stats_show(struct seq_file *m, void *v)
2525
{
2626
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;
3030

3131
get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi);
3232

‎mm/page-writeback.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,13 @@ unsigned long determine_dirtyable_memory(void)
362362
}
363363

364364
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)
367367
{
368368
int background_ratio; /* Percentages */
369369
int dirty_ratio;
370-
long background;
371-
long dirty;
370+
unsigned long background;
371+
unsigned long dirty;
372372
unsigned long available_memory = determine_dirtyable_memory();
373373
struct task_struct *tsk;
374374

@@ -423,9 +423,9 @@ static void balance_dirty_pages(struct address_space *mapping)
423423
{
424424
long nr_reclaimable, bdi_nr_reclaimable;
425425
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;
429429
unsigned long pages_written = 0;
430430
unsigned long write_chunk = sync_writeback_pages();
431431

@@ -580,8 +580,8 @@ EXPORT_SYMBOL(balance_dirty_pages_ratelimited_nr);
580580

581581
void throttle_vm_writeout(gfp_t gfp_mask)
582582
{
583-
long background_thresh;
584-
long dirty_thresh;
583+
unsigned long background_thresh;
584+
unsigned long dirty_thresh;
585585

586586
for ( ; ; ) {
587587
get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
@@ -624,8 +624,8 @@ static void background_writeout(unsigned long _min_pages)
624624
};
625625

626626
for ( ; ; ) {
627-
long background_thresh;
628-
long dirty_thresh;
627+
unsigned long background_thresh;
628+
unsigned long dirty_thresh;
629629

630630
get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL);
631631
if (global_page_state(NR_FILE_DIRTY) +

0 commit comments

Comments
 (0)