Re: [PATCH 3/4] kernel: add support for TIF_NOTIFY_SIGNAL

Oleg Nesterov
2020-10-09T14:43:38Z

Once again, I am fine with this patch, just a minor comment...

On 10/08, Jens Axboe wrote:
>
> --- a/arch/x86/kernel/signal.c
> +++ b/arch/x86/kernel/signal.c
> @@ -808,7 +808,10 @@ void arch_do_signal(struct pt_regs *regs)
> {
> struct ksignal ksig;
>
> - if (get_signal(&ksig)) {
> + if (test_thread_flag(TIF_NOTIFY_SIGNAL))
> + tracehook_notify_signal();
> +
> + if (task_sigpending(current) && get_signal(&ksig)) {

I suggested to change arch_do_signal() because somehow I like it this way ;)

And because we can easily pass the "ti_work" mask to arch_do_signal() and
avoid test_thread_flag/task_sigpending.

Hmm. I just noticed that only x86 uses arch_do_signal(), so perhaps you can
add this change to this patch right now? Up to you.

On the other hand, we could add

if (test_thread_flag(TIF_NOTIFY_SIGNAL))
tracehook_notify_signal();

if (!task_sigpending(current))
return 0;

at the start of get_signal() instead. Somehow I don't really like this, but
this way we do need less changes in arch-dependant code. Again, up to you.

Oleg.