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 <[email protected]> > --- ... > + __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.
