Skip to content

Commit dcf975d

Browse files
H Hartley Sweetentorvalds
authored andcommitted
mm/page-writeback.c: dirty limit type should be unsigned long
get_dirty_limits() calls clip_bdi_dirty_limit() and task_dirty_limit() with variable pbdi_dirty as one of the arguments. This variable is an unsigned long * but both functions expect it to be a long *. This causes the following sparse warnings: warning: incorrect type in argument 3 (different signedness) expected long *pbdi_dirty got unsigned long *pbdi_dirty warning: incorrect type in argument 2 (different signedness) expected long *pdirty got unsigned long *pbdi_dirty Fix the warnings by changing the long * to unsigned long * in both functions. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 78dc583 commit dcf975d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎mm/page-writeback.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,19 @@ static void bdi_writeout_fraction(struct backing_dev_info *bdi,
265265
* This avoids exceeding the total dirty_limit when the floating averages
266266
* fluctuate too quickly.
267267
*/
268-
static void
269-
clip_bdi_dirty_limit(struct backing_dev_info *bdi, long dirty, long *pbdi_dirty)
268+
static void clip_bdi_dirty_limit(struct backing_dev_info *bdi,
269+
unsigned long dirty, unsigned long *pbdi_dirty)
270270
{
271-
long avail_dirty;
271+
unsigned long avail_dirty;
272272

273-
avail_dirty = dirty -
274-
(global_page_state(NR_FILE_DIRTY) +
273+
avail_dirty = global_page_state(NR_FILE_DIRTY) +
275274
global_page_state(NR_WRITEBACK) +
276275
global_page_state(NR_UNSTABLE_NFS) +
277-
global_page_state(NR_WRITEBACK_TEMP));
276+
global_page_state(NR_WRITEBACK_TEMP);
278277

279-
if (avail_dirty < 0)
278+
if (avail_dirty < dirty)
279+
avail_dirty = dirty - avail_dirty;
280+
else
280281
avail_dirty = 0;
281282

282283
avail_dirty += bdi_stat(bdi, BDI_RECLAIMABLE) +
@@ -299,10 +300,10 @@ static inline void task_dirties_fraction(struct task_struct *tsk,
299300
*
300301
* dirty -= (dirty/8) * p_{t}
301302
*/
302-
static void task_dirty_limit(struct task_struct *tsk, long *pdirty)
303+
static void task_dirty_limit(struct task_struct *tsk, unsigned long *pdirty)
303304
{
304305
long numerator, denominator;
305-
long dirty = *pdirty;
306+
unsigned long dirty = *pdirty;
306307
u64 inv = dirty >> 3;
307308

308309
task_dirties_fraction(tsk, &numerator, &denominator);

0 commit comments

Comments
 (0)