Files
linux/kernel
Mateusz Guzik 6d864a1b18 pid: only take pidmap_lock once on alloc
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.

The change also facilitated some cosmetic fixes.

It has an unintentional side effect of no longer issuing spurious
idr_preload() around idr_replace().

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251203092851.287617-3-mjguzik@gmail.com
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-12-15 14:33:38 +01:00
..
2025-11-09 21:19:44 -08:00
2025-10-16 11:13:53 +02:00
2025-11-11 10:01:31 +01:00
2025-11-14 18:15:49 +08:00
2025-12-15 14:33:38 +01:00
2025-11-04 08:30:50 +01:00
2025-10-29 10:29:54 +01:00