Skip to content

mm: zone lock tracepoint instrumentation

Dmitry Ilvokhin linux-cxl linux-mm linux-pm linux-trace-kernel lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 42 repliesIn review
  2. v35 patches 16 repliesSuperseded
  3. v24 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches13 repliesSuperseded

Changes in v4 from the cover letter

- Fix build errors in kernel/power/snapshot.c and mm/shuffle.c files.
- Remove EXPORT_SYMBOL().
- Rename header zone_lock.h to mmzone_lock.h.
- Properly indent __acquires() annotation.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm: introduce zone lock wrappersMAINTAINERS include/linux/mmzone_lock.h+39 -04 replies
2/5mm: convert zone lock users to wrapperskernel/power/snapshot.c mm/compaction.c mm/memory_hotplug.c +8 more+94 -814 replies
3/5mm: convert compaction to zone lock wrappersmm/compaction.c+24 -94 replies
4/5mm: rename zone->lock to zone->_lockinclude/linux/mmzone.h include/linux/mmzone_lock.h mm/compaction.c +4 more+25 -2216 replies
5/5mm: add tracepoints for zone lockMAINTAINERS include/linux/mmzone_lock.h include/trace/events/zone_lock.h +2 more+157 -23 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchShakeel ButtSeongJae ParkDavid Hildenbrand (Arm)Zi YanVlastimil Babka (SUSE)
1/5A-b R-b A-b A-b R-b
2/5A-b R-b A-b A-b R-b
3/5A-b R-b A-b A-b R-b
4/5A-b A-b A-b A-b A-b R-b A-b
5/5A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/5] mm: zone lock tracepoint instrumentation

Zone lock contention can significantly impact allocation and reclaim latency, as it is a central synchronization point in the page allocator and reclaim paths. Improved visibility into its behavior is therefore important for diagnosing performance issues in memory-intensive workloads.

On some production workloads at Meta, we have observed noticeable zone lock contention. Deeper analysis of lock holders and waiters is currently difficult with existing instrumentation.

While generic lock contention_begin/contention_end tracepoints cover the slow path, they do not provide sufficient visibility into lock hold times. In particular, the lack of a release-side event makes it difficult to identify long lock holders and correlate them with waiters. As a result, distinguishing between short bursts of contention and pathological long hold times requires additional instrumentation.

This patch series adds dedicated tracepoint instrumentation to zone lock, following the existing mmap_lock tracing model.

The goal is to enable detailed holder/waiter analysis and lock hold time measurements without affecting the fast path when tracing is disabled.

The series is structured as follows:

1. Introduce zone lock wrappers.
2. Mechanically convert zone lock users to the wrappers.
3. Convert compaction to use the wrappers (requires minor restructuring of compact_lock_irqsave()).
4. Rename zone->lock to zone->_lock.
5. Add zone lock tracepoints.

The tracepoints are added via lightweight inline helpers in the wrappers. When tracing is disabled, the fast path remains unchanged.

Changes in v4:
- Fix build errors in kernel/power/snapshot.c and mm/shuffle.c files.
- Remove EXPORT_SYMBOL().
- Rename header zone_lock.h to mmzone_lock.h.
- Properly indent __acquires() annotation.

Changes in v3:
- Split compact_lock_irqsave() to compact_zone_lock_irqsave() and compact_lruvec_lock_irqsave().
- Rename zone->lock to zone->_lock.

Changes in v2:
- Move mecanical changes from mm/compaction.c to different commit.
- Removed compact_do_zone_trylock() and compact_do_raw_trylock_irqsave().

v1: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/
v3: https://lore.kernel.org/all/[email protected]/

Dmitry Ilvokhin (5):
mm: introduce zone lock wrappers
mm: convert zone lock users to wrappers
mm: convert compaction to zone lock wrappers
mm: rename zone->lock to zone->_lock
mm: add tracepoints for zone lock

 MAINTAINERS                      |   2 +
 include/linux/mmzone.h           |   7 ++-
 include/linux/mmzone_lock.h      | 100 +++++++++++++++++++++++++++++++
 include/trace/events/zone_lock.h |  64 ++++++++++++++++++++
 kernel/power/snapshot.c          |   5 +-
 mm/Makefile                      |   2 +-
 mm/compaction.c                  |  58 +++++++++++-------
 mm/internal.h                    |   2 +-
 mm/memory_hotplug.c              |   9 +--
 mm/mm_init.c                     |   3 +-
 mm/page_alloc.c                  |  89 +++++++++++++--------------
 mm/page_isolation.c              |  23 +++----
 mm/page_owner.c                  |   2 +-
 mm/page_reporting.c              |  13 ++--
 mm/show_mem.c                    |   5 +-
 mm/shuffle.c                     |   9 +--
 mm/vmscan.c                      |   5 +-
 mm/vmstat.c                      |   9 +--
 mm/zone_lock.c                   |  28 +++++++++
 19 files changed, 330 insertions(+), 105 deletions(-)
 create mode 100644 include/linux/mmzone_lock.h
 create mode 100644 include/trace/events/zone_lock.h
 create mode 100644 mm/zone_lock.c
Signature · 1 line
2.47.3