[Devel] [PATCH RHEL10 COMMIT] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:42:15 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.6.vz10
------>
commit 7e492586e01dfe5cd3a2fcbe420fcc5ec3138340
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Aug 21 18:36:59 2026 +0200

    mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n
    
    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 72b6b986a08bd..d47c3de71a491 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
 


More information about the Devel mailing list