Commit 90ae8d670c12156f4328235aca1a528a8bfe6708

Authored by Andrew Morton
Committed by Linus Torvalds
1 parent af34770e55

mm/page_alloc.c:__setup_per_zone_wmarks: make min_pages unsigned long

`int' is an inappropriate type for a number-of-pages counter.

While we're there, use the clamp() macro.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Satoru Moriya <satoru.moriya@hds.com>
Cc: Simon Jeons <simon.jeons@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 5 deletions Side-by-side Diff

... ... @@ -5247,13 +5247,10 @@
5247 5247 * deltas controls asynch page reclaim, and so should
5248 5248 * not be capped for highmem.
5249 5249 */
5250   - int min_pages;
  5250 + unsigned long min_pages;
5251 5251  
5252 5252 min_pages = zone->present_pages / 1024;
5253   - if (min_pages < SWAP_CLUSTER_MAX)
5254   - min_pages = SWAP_CLUSTER_MAX;
5255   - if (min_pages > 128)
5256   - min_pages = 128;
  5253 + min_pages = clamp(min_pages, SWAP_CLUSTER_MAX, 128UL);
5257 5254 zone->watermark[WMARK_MIN] = min_pages;
5258 5255 } else {
5259 5256 /*