All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing.patch added to -mm tree
@ 2020-11-25 22:34 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-11-25 22:34 UTC (permalink / raw)
  To: andi.kleen, chris, feng.tang, guro, hannes, laoar.shao, longman,
	mhocko, mm-commits, rong.a.chen, shakeelb, tj, vdavydov.dev,
	ying.huang, zhengjun.xing


The patch titled
     Subject: mm: memcg: relayout structure mem_cgroup to avoid cache interference
has been added to the -mm tree.  Its filename is
     mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Feng Tang <feng.tang@intel.com>
Subject: mm: memcg: relayout structure mem_cgroup to avoid cache interference

0day reported one -22.7% regression for will-it-scale page_fault2 case [1]
on a 4 sockets 144 CPU platform, and bisected to it to be caused by
Waiman's optimization (commit bd0b230fe1) of saving one 'struct
page_counter' space for 'struct mem_cgroup'.

Initially we thought it was due to the cache alignment change introduced
by the patch, but further debug shows that it is due to some hot data
members ('vmstats_local', 'vmstats_percpu', 'vmstats') sit in 2 adjacent
cacheline (2N and 2N+1 cacheline), and when adjacent cache line prefetch
is enabled, it triggers an "extended level" of cache false sharing for 2
adjacent cache lines.

So exchange the 2 member blocks, while keeping mostly the original cache
alignment, which can restore and even enhance the performance, and save 64
bytes of space for 'struct mem_cgroup' (from 2880 to 2816, with 0day's
default RHEL-8.3 kernel config)

[1]. https://lore.kernel.org/lkml/20201102091543.GM31092@shao2-debian/

Link: https://lkml.kernel.org/r/20201125062445.GA51005@shbuild999.sh.intel.com
Fixes: bd0b230fe145 ("mm/memcg: unify swap and memsw page counters")
Signed-off-by: Feng Tang <feng.tang@intel.com>
Reported-by: kernel test robot <rong.a.chen@intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Chris Down <chris@chrisdown.name>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Yafang Shao <laoar.shao@gmail.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <andi.kleen@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/memcontrol.h |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

--- a/include/linux/memcontrol.h~mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing
+++ a/include/linux/memcontrol.h
@@ -282,20 +282,6 @@ struct mem_cgroup {
 
 	MEMCG_PADDING(_pad1_);
 
-	/*
-	 * set > 0 if pages under this cgroup are moving to other cgroup.
-	 */
-	atomic_t		moving_account;
-	struct task_struct	*move_lock_task;
-
-	/* Legacy local VM stats and events */
-	struct memcg_vmstats_percpu __percpu *vmstats_local;
-
-	/* Subtree VM stats and events (batched updates) */
-	struct memcg_vmstats_percpu __percpu *vmstats_percpu;
-
-	MEMCG_PADDING(_pad2_);
-
 	atomic_long_t		vmstats[MEMCG_NR_STAT];
 	atomic_long_t		vmevents[NR_VM_EVENT_ITEMS];
 
@@ -317,6 +303,20 @@ struct mem_cgroup {
 	struct list_head objcg_list; /* list of inherited objcgs */
 #endif
 
+	MEMCG_PADDING(_pad2_);
+
+	/*
+	 * set > 0 if pages under this cgroup are moving to other cgroup.
+	 */
+	atomic_t		moving_account;
+	struct task_struct	*move_lock_task;
+
+	/* Legacy local VM stats and events */
+	struct memcg_vmstats_percpu __percpu *vmstats_local;
+
+	/* Subtree VM stats and events (batched updates) */
+	struct memcg_vmstats_percpu __percpu *vmstats_percpu;
+
 #ifdef CONFIG_CGROUP_WRITEBACK
 	struct list_head cgwb_list;
 	struct wb_domain cgwb_domain;
_

Patches currently in -mm which might be from feng.tang@intel.com are

mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-25 22:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 22:34 + mm-memcg-relayout-structure-mem_cgroup-to-avoid-cache-interfereing.patch added to -mm tree akpm

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.