mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	Usama Arif <usama.arif@linux.dev>,
	Meta kernel team <kernel-team@meta.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/6] memcg: group struct fields by access pattern
Date: Sat, 5 Sep 2026 16:34:22 -0700	[thread overview]
Message-ID: <20260905163422.4da655f452c4015cda0d4e3b@linux-foundation.org> (raw)
In-Reply-To: <20260905030522.1887837-1-shakeel.butt@linux.dev>

On Fri,  4 Sep 2026 20:05:16 -0700 Shakeel Butt <shakeel.butt@linux.dev> wrote:

> 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.
> 
> ...
>
> 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.

Sounds smart.

Significant repair work was needed for the struct mem_cgroup_per_node
and struct mem_cgroup alterations, due to the below pending changes.  I
think I got it all, please check.

--- linux-7.3-rc1/include/linux/memcontrol.h	2026-08-30 04:44:06.000000000 -0700
+++ 25/include/linux/memcontrol.h	2026-09-05 16:31:03.119571612 -0700
@@ -95,25 +95,12 @@ struct mem_cgroup_per_node {
 	struct lruvec_stats			*lruvec_stats;
 	struct shrinker_info __rcu	*shrinker_info;
 
-#ifdef CONFIG_MEMCG_V1
-	/*
-	 * Memcg-v1 only stuff in middle as buffer between read mostly fields
-	 * and update often fields to avoid false sharing. If v1 stuff is
-	 * not present, an explicit padding is needed.
-	 */
-
-	struct rb_node		tree_node;	/* RB tree node */
-	unsigned long		usage_in_excess;/* Set to the value by which */
-						/* the soft limit is exceeded*/
-	bool			on_tree;
-#else
 	CACHELINE_PADDING(_pad1_);
-#endif
 
 	/* Fields which get updated often at the end. */
 	struct lruvec		lruvec;
 	CACHELINE_PADDING(_pad2_);
-	unsigned long		lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
+	long			lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
 	struct mem_cgroup_reclaim_iter	iter;
 
 	/*
@@ -293,8 +280,6 @@ struct mem_cgroup {
 
 	struct memcg1_events_percpu __percpu *events_percpu;
 
-	unsigned long soft_limit;
-
 	/* protected by memcg_oom_lock */
 	bool oom_lock;
 	int under_oom;



      parent reply	other threads:[~2026-09-05 23:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05  3:05 Shakeel Butt
2026-09-05  3:05 ` [PATCH 1/6] memcg: move per-node objcg to the read-mostly fields Shakeel Butt
2026-09-05  3:05 ` [PATCH 2/6] memcg: split mem_cgroup_private_id into two fields Shakeel Butt
2026-09-05  3:05 ` [PATCH 3/6] memcg: group the write-hot fields of struct mem_cgroup Shakeel Butt
2026-09-05  3:05 ` [PATCH 4/6] memcg: group the cold " Shakeel Butt
2026-09-05  3:05 ` [PATCH 5/6] memcg: group the read-mostly " Shakeel Butt
2026-09-05  3:05 ` [PATCH 6/6] memcg: group the fields of struct mem_cgroup_per_node Shakeel Butt
2026-09-05 23:34 ` Andrew Morton [this message]

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=20260905163422.4da655f452c4015cda0d4e3b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=usama.arif@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®