memcg-move-per-node-objcg-to-the-read-mostly-fields.patch removed from -mm tree
The quilt patch titled
Subject: memcg: move per-node objcg to the read-mostly fields
has been removed from the -mm tree. Its filename was
memcg-move-per-node-objcg-to-the-read-mostly-fields.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Shakeel Butt <[email protected]>
Subject: memcg: move per-node objcg to the read-mostly fields
Date: Fri, 4 Sep 2026 20:05:17 -0700
Patch series "memcg: group struct fields by access pattern".
Every so often we get a memcg performance regression caused by nothing more than a field moving. Someone adds a field, removes one, or puts a few behind a config option. The layout shifts, fields with different access patterns land on the same cache line, and a bot reports a regression.
Two examples. commit 98c9daf5ae6b ("mm: memcg: guard memcg1-specific members of struct mem_cgroup_per_node") moved lruvec next to lru_zone_size[] and needed commit f59adcf59332 ("mm: memcg: add cacheline padding after lruvec in mem_cgroup_per_node") to fix it. commit c1afbd5de131 ("mm/memcontrol: avoid false sharing between vmstats and events") had to add ____cacheline_aligned_in_smp for the same reason.
Each fix was correct but nothing stops the next field addition from undoing it.
This series makes the layout a contract the compiler checks, the same way struct net_device does it. Fields are sorted into named cache line groups by access pattern, and memcg_struct_check() verifies at build time that every field sits in its group. A field added in the wrong place now breaks the build instead of quietly costing a few percent.
struct mem_cgroup gets three groups:
memcg_write_hot written on the charge, reclaim and socket paths memcg_cold only the cgroup control paths touch these memcg_read_mostly set when the memcg is created, then only read
Testing
=======
The cgroup selftests give identical results with and without the series.
For performance, two identical 30 core Xeon machines each ran both kernels, with the boot order swapped between them so that machine and order effects cancel. The useful tests run two workloads at once in one cgroup, because false sharing only shows up when one side reads a field that the other side writes.
slab allocs + page faults, slab side +1.2%
page faults + memory.stat readers, fault side +1.3% page faults + memory.stat readers, reader side +0.8%
everything else no change
No test regressed. The gains are small but the point of the series is the build time contract.
This patch (of 6):
current_obj_cgroup() reads memcg->nodeinfo[nid]->objcg on every accounted allocation. The field sits at the end of struct mem_cgroup_per_node, on the same cache line as lru_zone_size[] and iter. lru_zone_size[] is written on every LRU add and remove, and iter is written on every reclaim iteration.
Move objcg next to the other read-mostly pointers at the start of the struct.
No functional change.
---
include/linux/memcontrol.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/memcontrol.h renamed from include/linux/memcontrol.h~memcg-move-per-node-objcg-to-the-read-mostly-fields +2 -3
@@ -94,6 +94,7 @@ struct mem_cgroup_per_node {struct lruvec_stats_percpu __percpu *lruvec_stats_percpu;struct lruvec_stats *lruvec_stats;struct shrinker_info __rcu *shrinker_info; +struct obj_cgroup __rcu *objcg;CACHELINE_PADDING (_pad1_);
@@ -104,11 +105,9 @@ struct mem_cgroup_per_node {struct mem_cgroup_reclaim_iter iter;/* -* objcg is wiped out as a part of the objcg repaprenting process. * orig_objcg preserves a pointer (and a reference) to the original -* objcg until the end of live of memcg. +* objcg until the end of life of memcg. */ -struct obj_cgroup __rcu *objcg;struct obj_cgroup *orig_objcg;/* list of inherited objcgs, protected by objcg_lock */ struct list_head objcg_list;
_
Patches currently in -mm which might be from [email protected] are