[RFC PATCH v2 0/5] mm/vmscan: adaptive multi-threaded kswapd for NUMA-aware reclaim

From: Ehab Ababneh

Date: Fri Oct 09 2026 - 16:34:44 EST


This is a follow-up to the RFC for adaptive multi-threaded kswapd
on NUMA. It handles concurrent MGLRU aging, adjusts wakeups to node
CPU load, and scales the hopeless threshold for multiple workers.

Under memory pressure, an lruvec can end up with only two MGLRU
generations. That leaves an older and a younger cohort, a bit like
inactive and active LRU lists, though MGLRU tracks age differently.

Regarding the concerns raised in review:
- In the updated Cassandra comparison, four kswapd threads reduced p99
latency from 6.5 ms to 3.35 ms (about 49%) and increased throughput by
10.3%. We believe the latency gain comes from the reclaim design,
not from changes to LRU locking.
- This newer result compares four kswapd threads with one. The earlier
7.3% throughput result was measured with eight threads.

We also saw periods with zero file scans. The MIN_NR_GENS guard may
contribute: when only two generations remain, it makes scan_folios()
return without scanning the oldest one. This patch tests whether letting
kswapd scan that generation helps reclaim progress. The current traces
do not tie the zero-scan events to the same lruvec, so this remains a
hypothesis; more per-lruvec tracing is needed to compare it with lock
contention.

Changes since v1:
- Add a diagnostic kswapd scan path at MIN_NR_GENS.
- Scale the hopeless-node retry threshold by the active worker count.

Testing:
- Cassandra workload with one and four kswapd threads.

Buddy Lumpkin (1):
vmscan: Support multiple kswapd threads per node

Ehab Ababneh (4):
mm/vmscan: silence spurious max_seq race warning
mm/vmscan: make kswapd wakeups NUMA load-aware
mm/vmscan: let kswapd scan minimum-generation lruvecs
mm/vmscan: scale hopeless threshold for kswapd workers

include/linux/mmzone.h | 5 +-
include/trace/events/vmscan.h | 32 +++
mm/compaction.c | 8 +-
mm/internal.h | 3 +
mm/page_alloc.c | 26 +++
mm/vmscan.c | 426 ++++++++++++++++++++++++++++++++--
6 files changed, 473 insertions(+), 27 deletions(-)

--
2.43.0