Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 */