Skip to content

RFC mm/vmscan: adaptive multi-threaded kswapd for NUMA-aware reclaim

Ehab Ababneh linux-mm linux-trace-kernel lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest5 patches 8 repliesIn review
  2. v1 RFC3 patches 2 repliesSuperseded

Changes in v2 from the cover letter

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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5vmscan: Support multiple kswapd threads per nodeinclude/linux/mmzone.h mm/compaction.c mm/internal.h +2 more+128 -181 reply
2/5mm/vmscan: silence spurious max_seq race warningmm/vmscan.c+1 -30 replies
3/5mm/vmscan: make kswapd wakeups NUMA load-awareinclude/trace/events/vmscan.h mm/internal.h mm/page_alloc.c +1 more+369 -320 replies
4/5mm/vmscan: let kswapd scan minimum-generation lruvecsmm/vmscan.c+1 -10 replies
5/5mm/vmscan: scale hopeless threshold for kswapd workersmm/vmscan.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

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

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(-)
Signature · 1 line
2.43.0