From: Tycho Andersen <tycho@kernel.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: oleg@redhat.com, brauner@kernel.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
linux-mm@kvack.org, willy@infradead.org
Subject: Re: [PATCH v3 2/2] pid: only take pidmap_lock once on alloc
Date: Tue, 16 Dec 2025 10:09:15 -0700 [thread overview]
Message-ID: <aUGSO68Am0VWVAuv@tycho.pizza> (raw)
In-Reply-To: <20251206131955.780557-3-mjguzik@gmail.com>
Hi Mateusz,
On Sat, Dec 06, 2025 at 02:19:55PM +0100, Mateusz Guzik wrote:
> When spawning and killing threads in separate processes in parallel the
> primary bottleneck on the stock kernel is pidmap_lock, largely because
> of a back-to-back acquire in the common case. This aspect is fixed with
> the patch.
>
> Performance improvement varies between reboots. When benchmarking with
> 20 processes creating and killing threads in a loop, the unpatched
> baseline hovers around 465k ops/s, while patched is anything between
> ~510k ops/s and ~560k depending on false-sharing (which I only minimally
> sanitized). So this is at least 10% if you are unlucky.
Thanks for the patch.
In a particularly pathological case I can get a substantial
improvement in kernel CPU time with this patch:
Before: Time (mean ± σ): 53.007 s ± 0.148 s [User: 430.891 s, System: 12406.459 s]
After : Time (mean ± σ): 45.624 s ± 0.394 s [User: 435.021 s, System: 7692.072 s]
across 10 different boots. Feel free to add
Tested-by: Tycho Andersen (AMD) <tycho@kernel.org>
> + * (the routine unfortunately returns void, so we have no idea if it got anywhere).
Is it worth changing the return type? The underlying function looks
like it knows whether the allocation was actually successful...
Tycho
next prev parent reply other threads:[~2025-12-16 17:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 13:19 [PATCH v3 0/2] further damage-control lack of clone scalability Mateusz Guzik
2025-12-06 13:19 ` [PATCH v3 1/2] ns: pad refcount Mateusz Guzik
2025-12-06 13:19 ` [PATCH v3 2/2] pid: only take pidmap_lock once on alloc Mateusz Guzik
2025-12-07 7:21 ` Matthew Wilcox
2025-12-07 9:21 ` Mateusz Guzik
2025-12-07 10:37 ` David Laight
2025-12-16 17:09 ` Tycho Andersen [this message]
2025-12-16 18:19 ` Mateusz Guzik
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=aUGSO68Am0VWVAuv@tycho.pizza \
--to=tycho@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mjguzik@gmail.com \
--cc=oleg@redhat.com \
--cc=willy@infradead.org \
/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