]> www.infradead.org Git - users/willy/pagecache.git/commit
signal: avoid clearing TIF_SIGPENDING in recalc_sigpending() if unset
authorMateusz Guzik <mjguzik@gmail.com>
Mon, 3 Mar 2025 13:49:08 +0000 (14:49 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 14 Mar 2025 22:56:11 +0000 (15:56 -0700)
commit692fd609ee652c89891a842431ee89a7841fa247
treecbc9609325e3d0477de27180b50532b05bd8e309
parent0a045722a51f62bd71bbe5d8353c2a0e541ed578
signal: avoid clearing TIF_SIGPENDING in recalc_sigpending() if unset

Clearing is an atomic op and the flag is not set most of the time.

When creating and destroying threads in the same process with the pthread
family, the primary bottleneck is calls to sigprocmask which take the
process-wide sighand lock.

Avoiding the atomic gives me a 2% bump in start/teardown rate at 24-core
scale.

Link: https://lkml.kernel.org/r/20250303134908.423242-1-mjguzik@gmail.com
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/signal.c