Re: [PATCH v5 2/3] mm: vmscan: add cgroup IDs to vmscan tracepoints
From: Shakeel Butt <shakeel.butt@linux.dev>
Date: 2026-01-27 23:44:27
Also in:
linux-mm
On Thu, Jan 22, 2026 at 10:25:09AM -0800, Thomas Ballasi wrote:
quoted hunk ↗ jump to hunk
Memory reclaim events are currently difficult to attribute to specific cgroups, making debugging memory pressure issues challenging. This patch adds memory cgroup ID (memcg_id) to key vmscan tracepoints to enable better correlation and analysis. For operations not associated with a specific cgroup, the field is defaulted to 0. Signed-off-by: Thomas Ballasi <redacted> --- include/trace/events/vmscan.h | 83 ++++++++++++++++++++--------------- mm/shrinker.c | 6 ++- mm/vmscan.c | 17 +++---- 3 files changed, 61 insertions(+), 45 deletions(-)diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index 490958fa10dee..20160e79eb0d7 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h@@ -114,85 +114,92 @@ TRACE_EVENT(mm_vmscan_wakeup_kswapd, DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, - TP_PROTO(int order, gfp_t gfp_flags), + TP_PROTO(gfp_t gfp_flags, int order, u64 memcg_id), - TP_ARGS(order, gfp_flags), + TP_ARGS(gfp_flags, order, memcg_id), TP_STRUCT__entry( - __field( int, order ) __field( unsigned long, gfp_flags ) + __field( u64, memcg_id ) + __field( int, order ) ), TP_fast_assign( - __entry->order = order; __entry->gfp_flags = (__force unsigned long)gfp_flags; + __entry->order = order; + __entry->memcg_id = memcg_id;
Please pass memcg pointer to tracepoints and call mem_cgroup_id(memcg) here.