Linux cgroups development
 help / color / mirror / Atom feed
* [PATCH] mm: memcontrol: update state_local when flushing NMI stats
@ 2026-07-13  8:50 Guopeng Zhang
  2026-07-13 10:22 ` Tao Cui
  2026-07-13 11:39 ` Johannes Weiner
  0 siblings, 2 replies; 3+ messages in thread
From: Guopeng Zhang @ 2026-07-13  8:50 UTC (permalink / raw)
  To: Andrew Morton, Shakeel Butt, Johannes Weiner
  Cc: Michal Hocko, Roman Gushchin, Muchun Song, Vlastimil Babka,
	Alexandre Ghiti, cgroups, linux-mm, linux-kernel, stable,
	Guopeng Zhang

From: Guopeng Zhang <zhangguopeng@kylinos.cn>

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 <zhangguopeng@kylinos.cn>
---
 mm/memcontrol.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 22f55aeb94f3..02599b8b6bd5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -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;
 		}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-13 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13  8:50 [PATCH] mm: memcontrol: update state_local when flushing NMI stats Guopeng Zhang
2026-07-13 10:22 ` Tao Cui
2026-07-13 11:39 ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox