Commit df0a6daa01fa3856c08f4274d4f21a8092caa480

Authored by Michal Hocko
Committed by Linus Torvalds
1 parent 9571a98290

mm: fix off-by-two in __zone_watermark_ok()

Commit 88f5acf88ae6 ("mm: page allocator: adjust the per-cpu counter
threshold when memory is low") changed the form how free_pages is
calculated but it forgot that we used to do free_pages - ((1 << order) -
1) so we ended up with off-by-two when calculating free_pages.

Reported-by: Wang Sheng-Hui <shhuiw@gmail.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

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

... ... @@ -1525,7 +1525,7 @@
1525 1525 long min = mark;
1526 1526 int o;
1527 1527  
1528   - free_pages -= (1 << order) + 1;
  1528 + free_pages -= (1 << order) - 1;
1529 1529 if (alloc_flags & ALLOC_HIGH)
1530 1530 min -= min / 2;
1531 1531 if (alloc_flags & ALLOC_HARDER)