The per-node failure counter advances once per worker balance pass that makes no reclaim progress. With multiple kswapd workers, it can reach MAX_RECLAIM_RETRIES while others are still reclaiming, marking the node hopeless prematurely. Scale the threshold by the active kswapd worker count so each worker keeps the existing retry budget. Signed-off-by: Ehab Ababneh --- mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9e051aac2203..61d46a376eb9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7940,7 +7940,8 @@ void kswapd_try_clear_hopeless(struct pglist_data *pgdat, bool kswapd_test_hopeless(pg_data_t *pgdat) { - return atomic_read(&pgdat->kswapd_failures) >= MAX_RECLAIM_RETRIES; + return atomic_read(&pgdat->kswapd_failures) >= + MAX_RECLAIM_RETRIES * READ_ONCE(current_kswapds_per_node); } #ifdef CONFIG_HIBERNATION -- 2.43.0