Skip to content

mm: honour compact_unevictable_allowed in mlock and CMA paths

Wandun Chen linux-mm linux-rt-devel linux-trace-kernel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 20 repliesIn review

Changes in v2 from the cover letter

1. On top of the isolate-path filtering, also filter by VM_LOCKED during the migration unmap step.

2. Make mlock/mlockall wait for in-flight migration entries, ensuring the folio is on the unevictable LRU before mlock[all] returns.

3. Dropped letting CMA migration take unevictable folios; instead migrate CMA folios out during mlock[all], avoiding migration at cma_alloc time.

4. Moved the tracepoint to the migration unmap path.

[1] https://lore.kernel.org/lkml/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mm/migrate: do not migrate folios mapped into VM_LOCKED VMAs under compactioninclude/linux/compaction.h include/linux/rmap.h mm/compaction.c +2 more+44 -88 replies
2/4mm/mlock: wait for migration to finish when mlocking a foliomm/mlock.c+21 -23 replies
3/4mm/migrate: add tracepoint for folios unmapped during migrationinclude/trace/events/migrate.h mm/rmap.c+33 -00 replies
4/4mm/mlock: migrate folios out of CMA when mlocking a rangemm/mlock.c+118 -19 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/4] mm: honour compact_unevictable_allowed in mlock and CMA paths

From: Wandun Chen <[email protected]>

vm.compact_unevictable_allowed=0 (the default on RT) is meant to keep compaction from touching unevictable folios. Several paths still migrate folios that are about to become unevictable, or in CMA regions, installing migration entries that a later access must wait on, then causing latency spikes on RT kernels.

This series fixes those paths and adds a tracepoint for diagnosis. It is a rework of the RFC [1] per review feedback, mainly from Vlastimil.

RFC --> v2:
1. On top of the isolate-path filtering, also filter by VM_LOCKED during the migration unmap step.

2. Make mlock/mlockall wait for in-flight migration entries, ensuring the folio is on the unevictable LRU before mlock[all] returns.

3. Dropped letting CMA migration take unevictable folios; instead migrate CMA folios out during mlock[all], avoiding migration at cma_alloc time.

4. Moved the tracepoint to the migration unmap path.

[1] https://lore.kernel.org/lkml/[email protected]/

Wandun Chen (4):
mm/migrate: do not migrate folios mapped into VM_LOCKED VMAs under
compaction
mm/mlock: wait for migration to finish when mlocking a folio mm/migrate: add tracepoint for folios unmapped during migration mm/mlock: migrate folios out of CMA when mlocking a range

 include/linux/compaction.h     |   6 ++
 include/linux/rmap.h           |   3 +
 include/trace/events/migrate.h |  29 +++++++
 mm/compaction.c                |   8 +-
 mm/migrate.c                   |  23 +++++-
 mm/mlock.c                     | 142 ++++++++++++++++++++++++++++++++-
 mm/rmap.c                      |  16 +++-
 7 files changed, 216 insertions(+), 11 deletions(-)
Signature · 1 line
2.43.0