From: Chen Ridong <chenridong@huaweicloud.com>
To: akpm@linux-foundation.org, Liam.Howlett@oracle.com,
lorenzo.stoakes@oracle.com, vbabka@suse.cz, jannh@google.com,
pfalcato@suse.de, bigeasy@linutronix.de, paulmck@kernel.org,
chenridong@huawei.com, roman.gushchin@linux.dev,
brauner@kernel.org, pmladek@suse.com, geert@linux-m68k.org,
mingo@kernel.org, rrangel@chromium.org, francesco@valla.it,
kpsingh@kernel.org, guoweikang.kernel@gmail.com, link@vivo.com,
viro@zeniv.linux.org.uk, neil@brown.name, nichen@iscas.ac.cn,
tglx@linutronix.de, frederic@kernel.org, peterz@infradead.org,
oleg@redhat.com, joel.granados@kernel.org, linux@weissschuh.net,
avagin@google.com, legion@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, lujialin4@huawei.com
Subject: [RFC next v2 0/2] ucounts: turn the atomic rlimit to percpu_counter
Date: Mon, 19 May 2025 13:11:49 +0000 [thread overview]
Message-ID: <20250519131151.988900-1-chenridong@huaweicloud.com> (raw)
From: Chen Ridong <chenridong@huawei.com>
The will-it-scale test case signal1 [1] has been observed. and the test
results reveal that the signal sending system call lacks linearity.
To further investigate this issue, we initiated a series of tests by
launching varying numbers of dockers and closely monitored the throughput
of each individual docker. The detailed test outcomes are presented as
follows:
| Dockers |1 |4 |8 |16 |32 |64 |
| Throughput |380068 |353204 |308948 |306453 |180659 |129152 |
The data clearly demonstrates a discernible trend: as the quantity of
dockers increases, the throughput per container progressively declines.
In-depth analysis has identified the root cause of this performance
degradation. The ucouts module conducts statistics on rlimit, which
involves a significant number of atomic operations. These atomic
operations, when acting on the same variable, trigger a substantial number
of cache misses or remote accesses, ultimately resulting in a drop in
performance.
This patch set addresses scalability issues in the ucounts rlimit by
replacing atomic rlimit counters with percpu_counter, which distributes
counts across CPU cores to reduce cache contention under heavy load.
Patch 1 modifies thate ucount can be freed until both the refcount and
rlimit are fully released, minimizing redundant summations. Patch 2 turns
the atomic rlimit to percpu_counter, which is suggested by Andrew.
[1] https://github.com/antonblanchard/will-it-scale/blob/master/tests/
---
v2: use percpu_counter intead of cache rlimit.
v1: https://lore.kernel.org/lkml/20250509072054.148257-1-chenridong@huaweicloud.com/
Chen Ridong (2):
ucounts: free ucount only count and rlimit are zero
ucounts: turn the atomic rlimit to percpu_counter
include/linux/user_namespace.h | 17 +++-
init/main.c | 1 +
ipc/mqueue.c | 6 +-
kernel/signal.c | 8 +-
kernel/ucount.c | 169 +++++++++++++++++++++++----------
mm/mlock.c | 5 +-
6 files changed, 138 insertions(+), 68 deletions(-)
--
2.34.1
next reply other threads:[~2025-05-19 13:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 13:11 Chen Ridong [this message]
2025-05-19 13:11 ` [RFC next v2 1/2] ucounts: free ucount only count and rlimit are zero Chen Ridong
2025-05-19 13:11 ` [RFC next v2 2/2] ucounts: turn the atomic rlimit to percpu_counter Chen Ridong
2025-05-19 19:32 ` [RFC next v2 0/2] " Jann Horn
2025-05-19 21:01 ` Alexey Gladkov
2025-05-19 21:24 ` Jann Horn
2025-05-21 1:48 ` Chen Ridong
2025-05-21 1:41 ` Chen Ridong
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=20250519131151.988900-1-chenridong@huaweicloud.com \
--to=chenridong@huaweicloud.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@google.com \
--cc=bigeasy@linutronix.de \
--cc=brauner@kernel.org \
--cc=chenridong@huawei.com \
--cc=francesco@valla.it \
--cc=frederic@kernel.org \
--cc=geert@linux-m68k.org \
--cc=guoweikang.kernel@gmail.com \
--cc=jannh@google.com \
--cc=joel.granados@kernel.org \
--cc=kpsingh@kernel.org \
--cc=legion@kernel.org \
--cc=link@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@weissschuh.net \
--cc=lorenzo.stoakes@oracle.com \
--cc=lujialin4@huawei.com \
--cc=mingo@kernel.org \
--cc=neil@brown.name \
--cc=nichen@iscas.ac.cn \
--cc=oleg@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pfalcato@suse.de \
--cc=pmladek@suse.com \
--cc=roman.gushchin@linux.dev \
--cc=rrangel@chromium.org \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
/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