Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a0035fc

Browse files
weixugcgregkh
authored andcommitted
mm/mglru: only clear kswapd_failures if reclaimable
commit b130ba4 upstream. lru_gen_shrink_node() unconditionally clears kswapd_failures, which can prevent kswapd from sleeping and cause 100% kswapd cpu usage even when kswapd repeatedly fails to make progress in reclaim. Only clear kswap_failures in lru_gen_shrink_node() if reclaim makes some progress, similar to shrink_node(). I happened to run into this problem in one of my tests recently. It requires a combination of several conditions: The allocator needs to allocate a right amount of pages such that it can wake up kswapd without itself being OOM killed; there is no memory for kswapd to reclaim (My test disables swap and cleans page cache first); no other process frees enough memory at the same time. Link: https://lkml.kernel.org/r/[email protected] Fixes: e4dde56 ("mm: multi-gen LRU: per-node lru_gen_folio lists") Signed-off-by: Wei Xu <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: Brian Geffon <[email protected]> Cc: Jan Alexander Steffens <[email protected]> Cc: Suleiman Souhlal <[email protected]> Cc: Yu Zhao <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 17396e3 commit a0035fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/vmscan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5603,8 +5603,8 @@ static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *
56035603

56045604
blk_finish_plug(&plug);
56055605
done:
5606-
/* kswapd should never fail */
5607-
pgdat->kswapd_failures = 0;
5606+
if (sc->nr_reclaimed > reclaimed)
5607+
pgdat->kswapd_failures = 0;
56085608
}
56095609

56105610
/******************************************************************************

0 commit comments

Comments
 (0)