diff options
author | Michal Hocko <mhocko@suse.cz> | 2012-01-10 15:08:02 -0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-11-26 19:11:59 +0800 |
commit | 2dd93590bafc75bc2850f6c1e4992133fb214e06 (patch) | |
tree | 24fc4837012c40ec626dee0a5e5632d0c8b63e40 /mm | |
parent | 2fe94a8aa5574894408c9a1b262a64406985371e (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')
-rw-r--r-- | mm/page_alloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 947a7e96f91d..ea4b9dcf43b7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1474,7 +1474,7 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, long min = mark; int o; - free_pages -= (1 << order) + 1; + free_pages -= (1 << order) - 1; if (alloc_flags & ALLOC_HIGH) min -= min / 2; if (alloc_flags & ALLOC_HARDER) |