From: Shakeel Butt <shakeel.butt@linux.dev>
To: Oliver Sang <oliver.sang@intel.com>
Cc: oe-lkp@lists.linux.dev, lkp@intel.com,
Linux Memory Management List <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Yosry Ahmed <yosryahmed@google.com>,
"T.J. Mercier" <tjmercier@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
cgroups@vger.kernel.org, ying.huang@intel.com,
feng.tang@intel.com, fengwei.yin@intel.com
Subject: Re: [linux-next:master] [memcg] 70a64b7919: will-it-scale.per_process_ops -11.9% regression
Date: Tue, 21 May 2024 21:18:19 -0700 [thread overview]
Message-ID: <gpkpq3r3e7wxi6d7hbysfvg6chmuysluogsy47ifgm55d5ypy3@bs3kcqfgyxgp> (raw)
In-Reply-To: <ZkwKRH0Oc1S7r2LP@xsang-OptiPlex-9020>
On Tue, May 21, 2024 at 10:43:16AM +0800, Oliver Sang wrote:
> hi, Shakeel,
>
[...]
>
> we reported regression on a 2-node Skylake server. so I found a 1-node Skylake
> desktop (we don't have 1 node server) to check.
>
Please try the following patch on both single node and dual node
machines:
From 00a84b489b9e18abd1b8ec575ea31afacaf0734b Mon Sep 17 00:00:00 2001
From: Shakeel Butt <shakeel.butt@linux.dev>
Date: Tue, 21 May 2024 20:27:11 -0700
Subject: [PATCH] memcg: rearrage fields of mem_cgroup_per_node
At the moment the fields of mem_cgroup_per_node which get read on the
performance critical path share the cacheline with the fields which
might get updated. This cause contention of that cacheline for
concurrent readers. Let's move all the read only pointers at the start
of the struct, followed by memcg-v1 only fields and at the end fields
which get updated often.
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
---
include/linux/memcontrol.h | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 030d34e9d117..16efd9737be9 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -96,23 +96,25 @@ struct mem_cgroup_reclaim_iter {
* per-node information in memory controller.
*/
struct mem_cgroup_per_node {
- struct lruvec lruvec;
+ /* Keep the read-only fields at the start */
+ struct mem_cgroup *memcg; /* Back pointer, we cannot */
+ /* use container_of */
struct lruvec_stats_percpu __percpu *lruvec_stats_percpu;
struct lruvec_stats *lruvec_stats;
-
- unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
-
- struct mem_cgroup_reclaim_iter iter;
-
struct shrinker_info __rcu *shrinker_info;
+ /* memcg-v1 only stuff in middle */
+
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;
- struct mem_cgroup *memcg; /* Back pointer, we cannot */
- /* use container_of */
+
+ /* Fields which get updated often at the end. */
+ struct lruvec lruvec;
+ unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
+ struct mem_cgroup_reclaim_iter iter;
};
struct mem_cgroup_threshold {
--
2.43.0
next prev parent reply other threads:[~2024-05-22 4:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 5:56 kernel test robot
2024-05-17 23:38 ` Yosry Ahmed
2024-05-18 6:28 ` Shakeel Butt
2024-05-19 9:14 ` Oliver Sang
2024-05-19 17:20 ` Shakeel Butt
2024-05-20 2:43 ` Oliver Sang
2024-05-20 3:49 ` Shakeel Butt
2024-05-21 2:43 ` Oliver Sang
2024-05-22 4:18 ` Shakeel Butt [this message]
2024-05-23 7:48 ` Oliver Sang
2024-05-23 16:47 ` Shakeel Butt
2024-05-24 7:45 ` Oliver Sang
2024-05-24 18:06 ` Shakeel Butt
2024-05-28 6:30 ` Shakeel Butt
2024-05-30 6:17 ` Oliver Sang
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=gpkpq3r3e7wxi6d7hbysfvg6chmuysluogsy47ifgm55d5ypy3@bs3kcqfgyxgp \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=feng.tang@intel.com \
--cc=fengwei.yin@intel.com \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=roman.gushchin@linux.dev \
--cc=tjmercier@google.com \
--cc=ying.huang@intel.com \
--cc=yosryahmed@google.com \
/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