From bde304bdf4ec4a5f58cc1e90fe2d9cd2d96304c4 Mon Sep 17 00:00:00 2001 From: Xishi Qiu Date: Thu, 5 Nov 2015 18:48:56 -0800 Subject: [PATCH] mm/page_alloc.c: skip ZONE_MOVABLE if required_kernelcore is larger than totalpages If kernelcore was not specified, or the kernelcore size is zero (required_movablecore >= totalpages), or the kernelcore size is larger than totalpages, there is no ZONE_MOVABLE. We should fill the zone with both kernel memory and movable memory. Signed-off-by: Xishi Qiu Reviewed-by: Yasuaki Ishimatsu Cc: Mel Gorman Cc: David Rientjes Cc: Tang Chen Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/page_alloc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 86f7d952e2cc..06e62300d627 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5675,8 +5675,11 @@ static void __init find_zone_movable_pfns_for_nodes(void) required_kernelcore = max(required_kernelcore, corepages); } - /* If kernelcore was not specified, there is no ZONE_MOVABLE */ - if (!required_kernelcore) + /* + * If kernelcore was not specified or kernelcore size is larger + * than totalpages, there is no ZONE_MOVABLE. + */ + if (!required_kernelcore || required_kernelcore >= totalpages) goto out; /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ -- 2.30.2