Re: [PATCH v6 1/2] posix-timers: Prefer delivery of signals to the current thread
From: Oleg Nesterov
Date: Thu Apr 04 2024 - 11:26:14 EST
On 04/04, Thomas Gleixner wrote:
>
> On Thu, Apr 04 2024 at 15:43, Oleg Nesterov wrote:
>
> > And this will happen with
> > or without the commit bcb7ee79029dca ("posix-timers: Prefer delivery of
> > signals to the current thread"). Any thread can dequeue a shared signal,
> > say, on return from interrupt.
> >
> > Just without that commit this "eventually" means A_LOT_OF_TIME
> > statistically.
>
> bcb7ee79029dca only directs the wakeup to current, but the signal is
> still queued in the process wide shared pending list. So the thread
> which sees sigpending() first will grab and deliver it to itself.
This is what I tried to say above.
> What we can actually test is the avoidance of waking up the main thread
> by doing the following in the main thread:
Hmm... I think it can be even simpler,
> I'm testing a modification which implements something like the above and
> the success condition is that the main thread does not return early from
> nanosleep() and has no signal accounted. It survived 2000 iterations by
> now.
Yes, but please see a trivial test-case I sent you few minutes ago.
Oleg.