aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.cz>2012-01-10 18:08:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:44 -0500
commitdf0a6daa01fa3856c08f4274d4f21a8092caa480 (patch)
tree089c112e98c87c4326443c21711bf9410c1989ce /mm/page_alloc.c
parent9571a982903bf9dcbca2479fd3e7dafd2211ecf9 (diff)
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>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4f95bcf0f2b1..59153da58c69 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1525,7 +1525,7 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark,
1525 long min = mark; 1525 long min = mark;
1526 int o; 1526 int o;
1527 1527
1528 free_pages -= (1 << order) + 1; 1528 free_pages -= (1 << order) - 1;
1529 if (alloc_flags & ALLOC_HIGH) 1529 if (alloc_flags & ALLOC_HIGH)
1530 min -= min / 2; 1530 min -= min / 2;
1531 if (alloc_flags & ALLOC_HARDER) 1531 if (alloc_flags & ALLOC_HARDER)