On 09/02, Peter Zijlstra wrote: > > FWIW, the way the mutex code avoids this issue is by doing the > signal_pending test while holding the q->lock, that way its exclusive > with wakeup.
And __wait_event_interruptible_locked() too. BTW it is buggy anyway, it needs the - __add_wait_queue_tail(&(wq), &__wait); + if (exclusive) + __add_wait_queue_tail(&(wq), &__wait); + else + __add_wait_queue((&(wq), &__wait); and in fact it should use __add_wait_queue_exclusive() so that we can remove another "if (exclusive)" but this is off-topic. Yes, I considered this option, but to me the addtional finish_wait() looks simpler. And, if you agree with this change I will try to change __wait_event() as well and kill abort_exclusive_wait(). And in this case we certainly do not want to check the "condition" with q->lock held, because this would mean that "condition" won't be able to take this lock. Oleg.