Commit 496b919b authored by Rik van Riel's avatar Rik van Riel Committed by Linus Torvalds

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: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarRik van Riel <riel@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 250f6715
......@@ -2946,7 +2946,8 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment