Messages in this thread | | | From | Linus Torvalds <> | Date | Wed, 24 Jun 2020 09:22:30 -0700 | Subject | Re: wait_on_page_bit_common(TASK_KILLABLE, EXCLUSIVE) can miss wakeup? |
| |
On Wed, Jun 24, 2020 at 9:11 AM Oleg Nesterov <oleg@redhat.com> wrote: > > T1 checks signal_pending_state() and returns EINTR. > > T2 will sleep until another thread does lock/unlock ?
Yeah, this is a nasty pattern with any exclusive wait, we've had this bug before where an exclusive wait exits without taking the event or waking up the next waiter.
That said, I'm not entirely happy with your patch.
The real problem, I feel, is that
if (likely(bit_is_set)) io_schedule();
anti-pattern. Without that, we wouldn't have the bug.
Normally, we'd be TASK_RUNNING in this sequence, but because we might skip io_schedule(), we can still be in a "sleeping" state here and be "woken up" between that bit setting and the signal check.
Linus
| |