From: Kairui Song <ryncsn@gmail.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Hugh Dickins <hughd@google.com>,
"Huang, Ying" <ying.huang@linux.alibaba.com>,
Yosry Ahmed <yosryahmed@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Barry Song <baohua@kernel.org>, Michal Hocko <mhocko@kernel.org>,
linux-kernel@vger.kernel.org, Kairui Song <kasong@tencent.com>
Subject: [PATCH v2 0/3] mm/swap_cgroup: remove global swap cgroup lock
Date: Tue, 10 Dec 2024 17:28:02 +0800 [thread overview]
Message-ID: <20241210092805.87281-1-ryncsn@gmail.com> (raw)
From: Kairui Song <kasong@tencent.com>
This series removes the global swap cgroup lock. The critical section of
this lock is very short but it's still a bottle neck for mass parallel
swap workloads.
Up to 10% performance gain for tmpfs build kernel test on a
48c96t system, and no regression for other cases:
Testing using 64G brd and build with build kernel with make -j96 in 1.5G
memory cgroup using 4k folios showed below improvement (10 test run):
Before this series:
Sys time: 10809.46 (stdev 80.831491)
Real time: 171.41 (stdev 1.239894)
After this commit:
Sys time: 9621.26 (stdev 34.620000), -10.42%
Real time: 160.00 (stdev 0.497814), -6.57%
With 64k folios and 2G memcg:
Before this series:
Sys time: 8231.99 (stdev 30.030994)
Real time: 143.57 (stdev 0.577394)
After this commit:
Sys time: 7403.47 (stdev 6.270000), -10.06%
Real time: 135.18 (stdev 0.605000), -5.84%
Sequential swapout of 8G 64k zero folios (24 test run):
Before this series:
5461409.12 us (stdev 183957.827084)
After this commit:
5420447.26 us (stdev 196419.240317)
Sequential swapin of 8G 4k zero folios (24 test run):
Before this series:
19736958.916667 us (stdev 189027.246676)
After this commit:
19662182.629630 us (stdev 172717.640614)
V1: https://lore.kernel.org/linux-mm/20241202184154.19321-1-ryncsn@gmail.com/
Updates:
- Collect Review and Ack.
- Use bit shift instead of a mixed usage of short and atomic for
emulating 2 byte xchg [Chris Li]
- Merge patch 3 into patch 4 for simplicity [Roman Gushchin].
- Drop call of mem_cgroup_disabled instead in patch 1, also fix bot
build error [Yosry Ahmed]
- Wrap the access of the atomic_t map with helpers properly, so the
emulation can be dropped to use native 2 byte xchg once available.
Kairui Song (3):
mm, memcontrol: avoid duplicated memcg enable check
mm/swap_cgroup: remove swap_cgroup_cmpxchg
mm, swap_cgroup: remove global swap cgroup lock
include/linux/swap_cgroup.h | 2 -
mm/memcontrol.c | 2 +-
mm/swap_cgroup.c | 96 ++++++++++++++++---------------------
3 files changed, 43 insertions(+), 57 deletions(-)
--
2.47.1
next reply other threads:[~2024-12-10 9:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 9:28 Kairui Song [this message]
2024-12-10 9:28 ` [PATCH v2 1/3] mm, memcontrol: avoid duplicated memcg enable check Kairui Song
2024-12-10 9:28 ` [PATCH v2 2/3] mm/swap_cgroup: remove swap_cgroup_cmpxchg Kairui Song
2024-12-10 9:28 ` [PATCH v2 3/3] mm, swap_cgroup: remove global swap cgroup lock Kairui Song
2024-12-11 1:19 ` Roman Gushchin
2024-12-14 16:07 ` Chris Li
2024-12-14 19:48 ` Kairui Song
2024-12-15 15:04 ` Chris Li
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=20241210092805.87281-1-ryncsn@gmail.com \
--to=ryncsn@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=chrisl@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=ying.huang@linux.alibaba.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