lkml.org 
[lkml]   [2021]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [possible bug] missed wakeup in do_sigtimedwait()?
On Sat, Sep 4, 2021 at 9:59 AM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> I agree, that seems like a bug, and your fix seems the trivially correct thing.

Oh, never mind. Signals are special.

Why?

Because TASK_INTERRUPTIBLE is special, and schedule() will check for
"am I trying to sleep while a signal is pending" and will never
actually sleep.

So you can't have missed wakeups from signals, because this sequence
is perfectly ok, by design:

- signal comes in and is pending

- we set TASK_INTERRUPTIBLE

- we are thinking about something *entirely* different, like looking
at a pipe being emty

- we schedule()

and the pending signal will just mean that we never go to sleep.

It's designed that way exactly so that people who have interruptible
sleeps don't need to think about signals at all - they can concentrate
on doing their own thing, and then do the "signal_pending()" check at
any point without caring.

This has always been true, I had just swapped out that logic from memory.

Linus

\
 
 \ /
  Last update: 2021-09-04 19:12    [W:0.064 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site