* [PATCH RFC v3 0/7] mm/vmscan: move vmscan tracepoints to a local header
@ 2026-10-13 13:12 Ridong Chen
0 siblings, 0 replies; 2+ messages in thread
From: Ridong Chen @ 2026-10-13 13:12 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Johannes Weiner, Michal Hocko,
Roman Gushchin, Shakeel Butt, Andrew Morton, Dave Chinner
Cc: Mathieu Desnoyers, Muchun Song, Qi Zheng, David Hildenbrand,
Lorenzo Stoakes, Kairui Song, Barry Song, Axel Rasmussen,
Yuanchu Xie, Wei Xu, Baoquan He, Baolin Wang, linux-kernel,
linux-trace-kernel,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
open list:BPF [MISC]:Keyword:(?:b|_)bpf(?:b|_), Ridong Chen,
Ridong Chen
From: Ridong Chen <chenridong@xiaomi.com>
This series started as an effort to add two tracepoints for MGLRU. In the
discussion, Steven suggested moving include/trace/events/vmscan.h to
mm/trace_vmscan.h [1], as several other subsystems already do. Once the
header lives under mm/, struct scan_control can be moved there too, letting
the trace events access its fields directly instead of having each callsite
copy the scalars out by hand.
The series builds in small steps:
1) drop the unused vmscan trace include from memcontrol.c;
2) move include/trace/events/vmscan.h to mm/trace_vmscan.h, using a
relative TRACE_INCLUDE_PATH so no Makefile change is needed;
3) move struct scan_control into a dedicated mm/vmscan.h, which
trace_vmscan.h pulls in, guarded against the multi-read that
define_trace.h performs;
4-7) pass scan_control to the vmscan tracepoints and pick the fields
out in TP_fast_assign, one group at a time: the reclaim-begin
events, the LRU isolate/shrink events, mm_vmscan_reclaim_pages and
mm_vmscan_balance_pgdat_end.
Besides the cleanup, this moves the loads of the tracepoint arguments out
of the reclaim paths and into the trace event callbacks, which only run
when the event is enabled. On x86_64 with gcc 11.4, the callers in
mm/vmscan.o shrink accordingly (bytes), e.g.:
isolate_lru_folios 4060 -> 3896 (-164)
__node_reclaim 2258 -> 2076 (-182)
isolate_folios 8706 -> 8577 (-129)
shrink_active_list 3669 -> 3544 (-125)
evict_folios 4787 -> 4698 (-89)
There is no functional change. TP_STRUCT__entry and TP_printk are
untouched, so the tracefs event format is identical. This was confirmed
by diffing the tracefs format files before and after, and by capturing
the direct/memcg/node reclaim-begin events under load in a QEMU guest
(order, gfp_flags and memcg_id all match). BPF programs attached via
raw_tp/tp_btf do see the new TP_PROTO and need to be adjusted;
tracepoints are not a stable ABI (see Documentation/bpf/bpf_design_QA.rst).
highest_zoneidx and nr_reclaimed stay separate arguments: the former is
a balance_pgdat() parameter (sc.reclaim_idx may differ from it by the
time the end event fires), and the latter is the return value of
shrink_folio_list(), which does not update sc->nr_reclaimed.
[1]: https://lore.kernel.org/linux-mm/20260916095122.50cbb620@robin/
---
Changes in RFC v3:
- Use "Assisted-by: LLM" (Muchun).
- Note the BPF raw_tp/tp_btf impact in the changelogs (Sashiko).
- Changelog wording fixes and minor indentation fixes.
- Link to RFC v2: https://lore.kernel.org/all/20260928114625.3609130-1-ridong.chen@linux.dev/
Changes in RFC v2:
- Convert the remaining vmscan tracepoints too.
- Move struct scan_control to mm/vmscan.h (Baoquan).
Ridong Chen (7):
mm/memcontrol: drop unused vmscan tracepoint include
mm/vmscan: move vmscan tracepoints to a local header
mm/vmscan: move struct scan_control to a dedicated header
mm/vmscan: pass scan_control to the reclaim-begin tracepoints
mm/vmscan: pass scan_control to the LRU isolate/shrink tracepoints
mm/vmscan: pass scan_control to mm_vmscan_reclaim_pages
mm/vmscan: pass scan_control to mm_vmscan_balance_pgdat_end
MAINTAINERS | 4 +
mm/memcontrol.c | 2 -
mm/shrinker.c | 2 +-
.../events/vmscan.h => mm/trace_vmscan.h | 80 ++++++-----
mm/vmscan.c | 136 ++----------------
mm/vmscan.h | 118 +++++++++++++++
6 files changed, 178 insertions(+), 164 deletions(-)
rename include/trace/events/vmscan.h => mm/trace_vmscan.h (90%)
create mode 100644 mm/vmscan.h
base-commit: 4eb2586bd40db27d77cc5b724ca9386ed0c71d53
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH RFC v3 0/7] mm/vmscan: move vmscan tracepoints to a local header
@ 2026-10-13 13:13 Ridong Chen
0 siblings, 0 replies; 2+ messages in thread
From: Ridong Chen @ 2026-10-13 13:13 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Johannes Weiner, Michal Hocko,
Roman Gushchin, Shakeel Butt, Andrew Morton, Dave Chinner
Cc: Mathieu Desnoyers, Muchun Song, Qi Zheng, David Hildenbrand,
Lorenzo Stoakes, Kairui Song, Barry Song, Axel Rasmussen,
Yuanchu Xie, Wei Xu, Baoquan He, Baolin Wang, linux-kernel,
linux-trace-kernel,
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG),
open list:BPF [MISC]:Keyword:(?:b|_)bpf(?:b|_), Ridong Chen,
Ridong Chen
From: Ridong Chen <chenridong@xiaomi.com>
This series started as an effort to add two tracepoints for MGLRU. In the
discussion, Steven suggested moving include/trace/events/vmscan.h to
mm/trace_vmscan.h [1], as several other subsystems already do. Once the
header lives under mm/, struct scan_control can be moved there too, letting
the trace events access its fields directly instead of having each callsite
copy the scalars out by hand.
The series builds in small steps:
1) drop the unused vmscan trace include from memcontrol.c;
2) move include/trace/events/vmscan.h to mm/trace_vmscan.h, using a
relative TRACE_INCLUDE_PATH so no Makefile change is needed;
3) move struct scan_control into a dedicated mm/vmscan.h, which
trace_vmscan.h pulls in, guarded against the multi-read that
define_trace.h performs;
4-7) pass scan_control to the vmscan tracepoints and pick the fields
out in TP_fast_assign, one group at a time: the reclaim-begin
events, the LRU isolate/shrink events, mm_vmscan_reclaim_pages and
mm_vmscan_balance_pgdat_end.
Besides the cleanup, this moves the loads of the tracepoint arguments out
of the reclaim paths and into the trace event callbacks, which only run
when the event is enabled. On x86_64 with gcc 11.4, the callers in
mm/vmscan.o shrink accordingly (bytes), e.g.:
isolate_lru_folios 4060 -> 3896 (-164)
__node_reclaim 2258 -> 2076 (-182)
isolate_folios 8706 -> 8577 (-129)
shrink_active_list 3669 -> 3544 (-125)
evict_folios 4787 -> 4698 (-89)
There is no functional change. TP_STRUCT__entry and TP_printk are
untouched, so the tracefs event format is identical. This was confirmed
by diffing the tracefs format files before and after, and by capturing
the direct/memcg/node reclaim-begin events under load in a QEMU guest
(order, gfp_flags and memcg_id all match). BPF programs attached via
raw_tp/tp_btf do see the new TP_PROTO and need to be adjusted;
tracepoints are not a stable ABI (see Documentation/bpf/bpf_design_QA.rst).
highest_zoneidx and nr_reclaimed stay separate arguments: the former is
a balance_pgdat() parameter (sc.reclaim_idx may differ from it by the
time the end event fires), and the latter is the return value of
shrink_folio_list(), which does not update sc->nr_reclaimed.
[1]: https://lore.kernel.org/linux-mm/20260916095122.50cbb620@robin/
---
Changes in RFC v3:
- Use "Assisted-by: LLM" (Muchun).
- Note the BPF raw_tp/tp_btf impact in the changelogs (Sashiko).
- Changelog wording fixes and minor indentation fixes.
- Link to RFC v2: https://lore.kernel.org/all/20260928114625.3609130-1-ridong.chen@linux.dev/
Changes in RFC v2:
- Convert the remaining vmscan tracepoints too.
- Move struct scan_control to mm/vmscan.h (Baoquan).
Ridong Chen (7):
mm/memcontrol: drop unused vmscan tracepoint include
mm/vmscan: move vmscan tracepoints to a local header
mm/vmscan: move struct scan_control to a dedicated header
mm/vmscan: pass scan_control to the reclaim-begin tracepoints
mm/vmscan: pass scan_control to the LRU isolate/shrink tracepoints
mm/vmscan: pass scan_control to mm_vmscan_reclaim_pages
mm/vmscan: pass scan_control to mm_vmscan_balance_pgdat_end
MAINTAINERS | 4 +
mm/memcontrol.c | 2 -
mm/shrinker.c | 2 +-
.../events/vmscan.h => mm/trace_vmscan.h | 80 ++++++-----
mm/vmscan.c | 136 ++----------------
mm/vmscan.h | 118 +++++++++++++++
6 files changed, 178 insertions(+), 164 deletions(-)
rename include/trace/events/vmscan.h => mm/trace_vmscan.h (90%)
create mode 100644 mm/vmscan.h
base-commit: 4eb2586bd40db27d77cc5b724ca9386ed0c71d53
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-13 13:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 13:12 [PATCH RFC v3 0/7] mm/vmscan: move vmscan tracepoints to a local header Ridong Chen
-- strict thread matches above, loose matches on Subject: below --
2026-10-13 13:13 Ridong Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.