Thread (54 messages) 54 messages, 7 authors, 2026-03-16

Re: [PATCH v2 1/2] mm: vmscan: add cgroup IDs to vmscan tracepoints

From: Shakeel Butt <shakeel.butt@linux.dev>
Date: 2025-12-16 18:50:24
Also in: linux-mm

On Tue, Dec 16, 2025 at 06:02:51AM -0800, Thomas Ballasi wrote:
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>
---
...
+		__entry->memcg_id = sc->memcg ? mem_cgroup_id(sc->memcg) : 0;
...
+		__entry->memcg_id = sc->memcg ? mem_cgroup_id(sc->memcg) : 0;
...
 
...
 	trace_mm_vmscan_memcg_softlimit_reclaim_begin(sc.order,
-						      sc.gfp_mask);
+						      sc.gfp_mask,
+						      mem_cgroup_id(memcg));
 
...
+	trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed, mem_cgroup_id(memcg));
...
+	trace_mm_vmscan_memcg_reclaim_begin(0, sc.gfp_mask, mem_cgroup_id(memcg));
...
+	trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed, mem_cgroup_id(memcg));
Please don't use mem_cgroup_id() here as it is an ID internal to memcg.
Use cgroup_id(memcg->css.cgroup) instead which is inode number and is
exposed to the userspace.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help