* + kernel-refactor-shorten-has_pending_signals.patch added to mm-nonmm-unstable branch
@ 2026-06-30 4:14 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-06-30 4:14 UTC (permalink / raw)
To: mm-commits, peterz, oleg, elver, brauner, adrianhuang0701,
andrea.calabrese, akpm
The patch titled
Subject: kernel: refactor: shorten has_pending_signals
has been added to the -mm mm-nonmm-unstable branch. Its filename is
kernel-refactor-shorten-has_pending_signals.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kernel-refactor-shorten-has_pending_signals.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Subject: kernel: refactor: shorten has_pending_signals
Date: Wed, 20 May 2026 08:28:50 +0200
In has_pending_signals there was a switch/case used for optimizations.
However, today's compilers perform loop unrolling efficiently, thus it is
not needed anymore.
Put i inside the for declaration so we do not risk its escape from the
scope. Moreover, i starts now from 0 and counts up, as it is a more usual
pattern.
Link: https://lore.kernel.org/20260520062849.183621-2-andrea.calabrese@amarulasolutions.com
Signed-off-by: Andrea Calabrese <andrea.calabrese@amarulasolutions.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Adrian Huang <adrianhuang0701@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Marco Elver <elver@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/signal.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
--- a/kernel/signal.c~kernel-refactor-shorten-has_pending_signals
+++ a/kernel/signal.c
@@ -130,28 +130,10 @@ static bool sig_ignored(struct task_stru
*/
static inline bool has_pending_signals(sigset_t *signal, sigset_t *blocked)
{
- unsigned long ready;
- long i;
-
- switch (_NSIG_WORDS) {
- default:
- for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
- ready |= signal->sig[i] &~ blocked->sig[i];
- break;
-
- case 4: ready = signal->sig[3] &~ blocked->sig[3];
- ready |= signal->sig[2] &~ blocked->sig[2];
- ready |= signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
- break;
-
- case 2: ready = signal->sig[1] &~ blocked->sig[1];
- ready |= signal->sig[0] &~ blocked->sig[0];
- break;
-
- case 1: ready = signal->sig[0] &~ blocked->sig[0];
- }
- return ready != 0;
+ unsigned long ready = 0;
+ for (long i = 0; i < _NSIG_WORDS; i++)
+ ready |= signal->sig[i] & ~blocked->sig[i];
+ return ready != 0;
}
#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
_
Patches currently in -mm which might be from andrea.calabrese@amarulasolutions.com are
kernel-refactor-shorten-has_pending_signals.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-30 4:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 4:14 + kernel-refactor-shorten-has_pending_signals.patch added to mm-nonmm-unstable branch 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.