Re: [PATCH] kernel: refactor: shorten has_pending_signals

From: Oleg Nesterov

Date: Tue May 19 2026 - 11:14:20 EST


Hi Andrea,

thanks, but perhaps you can cleanup the changelog?

On 05/19, Andrea Calabrese wrote:
>
> In has_pending_signals there was a switch/case pattern that did not need
> to be there, as the default for loop also covers those cases.

Yes, but this code is very, very old. I agree, this optimization makes no
sense with the modern compilers, but your description doesn't look accurate.
The switch/case code was added on purpose, even if the default loop covers
those cases.

> This patch does not change the binary output of the file
> kernel/signal.o.

I guess you tested x86. Good.

> A diff between the files gives shows (old -> new):
> 2072c2072
> < case 1: ready = signal->sig[0] &~ blocked->sig[0];
> ---
> > ready |= signal->sig[i] & ~blocked->sig[i];
> 2149c2149
> < case 1: ready = signal->sig[0] &~ blocked->sig[0];
> ---
> > ready |= signal->sig[i] & ~blocked->sig[i];
> 2155c2155
> < case 1: ready = signal->sig[0] &~ blocked->sig[0];
> ---
> > ready |= signal->sig[i] & ~blocked->sig[i];
> 9799c9799
> < case 1: ready = signal->sig[0] &~ blocked->sig[0];
> ---
> > ready |= signal->sig[i] & ~blocked->sig[i];
> 9805c9805
> < case 1: ready = signal->sig[0] &~ blocked->sig[0];
> ---
> > ready |= signal->sig[i] & ~blocked->sig[i];

I don't understand this part of your changelog, but I think it should
be removed anyway ;)

Oleg.