Re: [patch -rt] Fix infinite loop with 2.6.31.4-rt14 V2

From: Darren Hart
Date: Fri Oct 23 2009 - 19:30:09 EST


Darren Hart wrote:
Dinakar Guniguntala wrote:
> Application threads calling futex_wait_requeue_pi run in an infinite loop
> in the kernel if the futex value changes during the call. The following
> patch fixes the problem.

The key bit here being that EAGAIN == EWOULDBLOCK - who thought that was a good idea?

And now that I think about it, when I reviewed this original patch I
remember mentioning that this isn't even needed for
futex_wait_requeue_pi() because we don't have the same wake-up race as
futex_wait() suffers from - since we don't use the same lock_ptr == NULL
test (nor do we use the wake_list in the requeue code). I suspect the
only case where -EAGAIN is being used here is when the uval doesn't
match val - no spurious wakeups.

Dino, can you try with the following patch which just reverts the
spurious wakeup handling for the requeue_pi path.