[Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Aug 21 19:36:59 MSK 2026
mem_cgroup_per_node::nid was added into a kABI hole in the middle of the
CONFIG_MEMCG_V1 part of the structure, but it is not a cgroup-v1 field:
percpu_stats_memcg() reads it on the lruvec stats path, to find the
matching per-node structure of the parent an update is forwarded to once a
dying memcg has had its percpu stats freed. So
CONFIG_MEMCG=y together with CONFIG_MEMCG_V1=n does not build:
mm/memcontrol.c: error: 'struct mem_cgroup_per_node' has no member
named 'nid'
Declare the field in the CONFIG_MEMCG_V1=n branch as well, next to the
other read-mostly members. The v1 branch is left exactly as it is, so
the layout of the shipped kernel - and with it the kABI checksum - does
not change.
Fixes: be640870964f ("mm/memcg: Free percpu stats memory of dying memcg's")
Feature: fix rh/mm
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
include/linux/memcontrol.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 72b6b986a08b..d47c3de71a49 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -109,6 +109,11 @@ struct mem_cgroup_per_node {
bool on_tree;
RH_KABI_FILL_HOLE(unsigned short nid)
#else
+ /*
+ * Not a v1 field: percpu_stats_memcg() needs the node id to find
+ * the matching per-node structure of the parent memcg.
+ */
+ unsigned short nid;
CACHELINE_PADDING(_pad1_);
#endif
--
2.47.1
More information about the Devel
mailing list