From 496b919b3bdd957d4b1727df79bfa3751bced1c1 Mon Sep 17 00:00:00 2001 From: Rik van Riel Date: Sat, 24 Mar 2012 10:26:21 -0400 Subject: [PATCH] Fix potential endless loop in kswapd when compaction is not enabled We should only test compaction_suitable if the kernel is built with CONFIG_COMPACTION, otherwise the stub compaction_suitable function will always return COMPACT_SKIPPED and send kswapd into an infinite loop. Reported-by: Anton Blanchard Signed-off-by: Rik van Riel Signed-off-by: Linus Torvalds --- mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 7658fd6536dd..33c332bbab73 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2946,7 +2946,8 @@ out: continue; /* Would compaction fail due to lack of free memory? */ - if (compaction_suitable(zone, order) == COMPACT_SKIPPED) + if (COMPACTION_BUILD && + compaction_suitable(zone, order) == COMPACT_SKIPPED) goto loop_again; /* Confirm the zone is balanced for order-0 */ -- 2.20.1