mm: fix overflow in find_zone_movable_pfns_for_nodes()
authorXishi Qiu <[email protected]>
Fri, 6 Nov 2015 02:48:11 +0000 (18:48 -0800)
committerLinus Torvalds <[email protected]>
Fri, 6 Nov 2015 03:34:48 +0000 (19:34 -0800)
If the user set "movablecore=xx" to a large number, corepages will
overflow.  Fix the problem.

Signed-off-by: Xishi Qiu <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Acked-by: Tang Chen <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Tang Chen <[email protected]>
Cc: Zhang Yanfei <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c

index c60605df9b48e03b79555b23b8b3f0e48d769a3e..4aed338fc5350544680dbbaf2e5c637b8327ca10 100644 (file)
@@ -5666,6 +5666,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
                 */
                required_movablecore =
                        roundup(required_movablecore, MAX_ORDER_NR_PAGES);
+               required_movablecore = min(totalpages, required_movablecore);
                corepages = totalpages - required_movablecore;
 
                required_kernelcore = max(required_kernelcore, corepages);