Skip to content

Commit

Permalink
Fix potential endless loop in kswapd when compaction is not enabled
Browse files Browse the repository at this point in the history
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 <anton@samba.org>
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Rik van Riel authored and Linus Torvalds committed Mar 24, 2012
1 parent 250f671 commit 496b919
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 496b919

Please sign in to comment.