From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,roman.gushchin@linux.dev,muchun.song@linux.dev,mhocko@kernel.org,hannes@cmpxchg.org,shakeel.butt@linux.dev,akpm@linux-foundation.org
Subject: [merged mm-stable] memcg-move-per-node-objcg-to-the-read-mostly-fields.patch removed from -mm tree
Date: Thu, 08 Oct 2026 22:56:50 -0700 [thread overview]
Message-ID: <20261009055650.C13AD1F000FF@smtp.kernel.org> (raw)
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 <shakeel.butt@linux.dev>
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.
Link: https://lore.kernel.org/20260905030522.1887837-1-shakeel.butt@linux.dev
Link: https://lore.kernel.org/20260905030522.1887837-2-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
---
include/linux/memcontrol.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/include/linux/memcontrol.h~memcg-move-per-node-objcg-to-the-read-mostly-fields
+++ a/include/linux/memcontrol.h
@@ -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 shakeel.butt@linux.dev are
reply other threads:[~2026-10-09 5:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261009055650.C13AD1F000FF@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=mhocko@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.