mm: memcontrol: update state_local when flushing NMI stats
Subsystems (4)
PATCH 1/1 mm: memcontrol: update state_local when flushing NMI stats
From: Guopeng Zhang <[email protected]>
flush_nmi_stats() updates state[] for kmem and slab counters but leaves the corresponding state_local[] counters unchanged. Local kmem and slab statistics therefore miss updates collected through the NMI-safe atomic path.
Update state_local[] together with state[].
--- mm/memcontrol.c | 5 +++++ 1 file changed, 5 insertions(+)
mm/memcontrol.c +5 -0
@@ -4443,6 +4443,7 @@ static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent,int index =memcg_stats_index (MEMCG_KMEM ); memcg->vmstats->state[index] += kmem; + memcg->vmstats->state_local[index] += kmem;if (parent) parent->vmstats->state_pending[index] += kmem; }
@@ -4460,9 +4461,11 @@ static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent,int index =memcg_stats_index (NR_SLAB_RECLAIMABLE_B ); lstats->state[index] += slab; + lstats->state_local[index] += slab;if (plstats) plstats->state_pending[index] += slab; memcg->vmstats->state[index] += slab; + memcg->vmstats->state_local[index] += slab;if (parent) parent->vmstats->state_pending[index] += slab; }
@@ -4471,9 +4474,11 @@ static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent,int index =memcg_stats_index (NR_SLAB_UNRECLAIMABLE_B ); lstats->state[index] += slab; + lstats->state_local[index] += slab;if (plstats) plstats->state_pending[index] += slab; memcg->vmstats->state[index] += slab; + memcg->vmstats->state_local[index] += slab;if (parent) parent->vmstats->state_pending[index] += slab; }
Signature · 1 line
2.43.0
Quoted 41 lines · Guopeng Zhang
From: Guopeng Zhang <[email protected]>
flush_nmi_stats()updates state[] for kmem and slab counters but leaves the corresponding state_local[] counters unchanged. Local kmem and slab statistics therefore miss updates collected through the NMI-safe atomic path.Update state_local[] together with state[].
Fixes 940b01fc8dc1 ("memcg: nmi safe memcg stats for specific archs")Signed-off-by Guopeng Zhang <[email protected]>--- mm/memcontrol.c | 5 +++++ 1 file changed, 5 insertions(+)mm/memcontrol.c +3
-0@@ -4443,6 +4443,7 @@ static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent,int index =memcg_stats_index (MEMCG_KMEM ); memcg->vmstats->state[index] += kmem; + memcg->vmstats->state_local[index] += kmem;if (parent) parent->vmstats->state_pending[index] += kmem; }@@ -4460,9 +4461,11 @@ static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent,int index =memcg_stats_index (NR_SLAB_RECLAIMABLE_B ); lstats->state[index] += slab; + lstats->state_local[index] += slab;if (plstats) plstats->state_pending[index] += slab; memcg->vmstats->state[index] += slab; + memcg->vmstats->state_local[index] += slab;if (parent) parent->vmstats->state_pending[index] += slab; }@@ -4471,9 +4474,11 @@ static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent,int index =memcg_stats_index (NR_SLAB_UNRECLAIMABLE_B );
mm/memcontrol.c static void flush_nmi_stats(struct mem_cgroup *memcg, struct mem_cgroup *parent, · line 4484
Quoted 10 lines
mm/memcontrol.c +2
-0lstats->state[index] += slab; + lstats->state_local[index] += slab;if (plstats) plstats->state_pending[index] += slab; memcg->vmstats->state[index] += slab; + memcg->vmstats->state_local[index] += slab;if (parent) parent->vmstats->state_pending[index] += slab; }
Looks correct — state_local[] mirrors state[] for this cgroup's own NMI-accounted kmem/slab charges, and pending→local is properly left untouched.
Quoted 11 lines · Guopeng Zhang
From: Guopeng Zhang <[email protected]>
flush_nmi_stats()updates state[] for kmem and slab counters but leaves the corresponding state_local[] counters unchanged. Local kmem and slab statistics therefore miss updates collected through the NMI-safe atomic path.Update state_local[] together with state[].
Fixes 940b01fc8dc1 ("memcg: nmi safe memcg stats for specific archs")Signed-off-by Guopeng Zhang <[email protected]>
This issue affects memcg1 but also the workingset shrinker.
And we should probably CC: stable # 6.15. Shakeel?
Shakeel Butt
maintainerQuoted 10 lines · Johannes Weiner
Quoted 9 lines · Guopeng Zhang
From: Guopeng Zhang <[email protected]>
flush_nmi_stats()updates state[] for kmem and slab counters but leaves the corresponding state_local[] counters unchanged. Local kmem and slab statistics therefore miss updates collected through the NMI-safe atomic path.Update state_local[] together with state[].
Quoted 8 lines
Quoted 2 lines
Fixes 940b01fc8dc1 ("memcg: nmi safe memcg stats for specific archs")Signed-off-by Guopeng Zhang <[email protected]>This issue affects memcg1 but also the workingset shrinker.
Acked-by Johannes Weiner <[email protected]>And we should probably CC: stable # 6.15. Shakeel?
Yes it makes sense.
Quoted 11 lines · Guopeng Zhang
From: Guopeng Zhang <[email protected]>
flush_nmi_stats()updates state[] for kmem and slab counters but leaves the corresponding state_local[] counters unchanged. Local kmem and slab statistics therefore miss updates collected through the NMI-safe atomic path.Update state_local[] together with state[].
Fixes 940b01fc8dc1 ("memcg: nmi safe memcg stats for specific archs")Signed-off-by Guopeng Zhang <[email protected]>