All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-nonmm-stable] signal-avoid-clearing-tif_sigpending-in-recalc_sigpending-if-unset.patch removed from -mm tree
@ 2025-03-17  5:32 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-03-17  5:32 UTC (permalink / raw)
  To: mm-commits, oleg, mjguzik, akpm


The quilt patch titled
     Subject: signal: avoid clearing TIF_SIGPENDING in recalc_sigpending() if unset
has been removed from the -mm tree.  Its filename was
     signal-avoid-clearing-tif_sigpending-in-recalc_sigpending-if-unset.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Mateusz Guzik <mjguzik@gmail.com>
Subject: signal: avoid clearing TIF_SIGPENDING in recalc_sigpending() if unset
Date: Mon, 3 Mar 2025 14:49:08 +0100

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.

[akpm@linux-foundation.org: add unlikely() as well]
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 |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/kernel/signal.c~signal-avoid-clearing-tif_sigpending-in-recalc_sigpending-if-unset
+++ a/kernel/signal.c
@@ -176,9 +176,10 @@ static bool recalc_sigpending_tsk(struct
 
 void recalc_sigpending(void)
 {
-	if (!recalc_sigpending_tsk(current) && !freezing(current))
-		clear_thread_flag(TIF_SIGPENDING);
-
+	if (!recalc_sigpending_tsk(current) && !freezing(current)) {
+		if (unlikely(test_thread_flag(TIF_SIGPENDING)))
+			clear_thread_flag(TIF_SIGPENDING);
+	}
 }
 EXPORT_SYMBOL(recalc_sigpending);
 
_

Patches currently in -mm which might be from mjguzik@gmail.com are



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-17  5:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  5:32 [merged mm-nonmm-stable] signal-avoid-clearing-tif_sigpending-in-recalc_sigpending-if-unset.patch removed from -mm tree Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.