Re: [patch 58/63] futex: Prevent requeue_pi() lock nesting issue on RT

From: Thomas Gleixner
Date: Tue Aug 03 2021 - 17:22:15 EST


On Tue, Aug 03 2021 at 13:20, Peter Zijlstra wrote:
> On Fri, Jul 30, 2021 at 03:51:05PM +0200, Thomas Gleixner wrote:
>> + /*
>> + * We were woken prior to requeue by a timeout or a signal.
>> + * Unqueue the futex_q and determine which it was.
>> + */
>> + plist_del(&q->list, &hb->chain);
>> + hb_waiters_dec(hb);
>> +
>> + /* Handle spurious wakeups gracefully */
>> + ret = -EWOULDBLOCK;
>> + if (timeout && !timeout->task)
>> + ret = -ETIMEDOUT;
>> + else if (signal_pending(current))
>> + ret = -ERESTARTNOINTR;
>> return ret;
>> }
>
> AFAICT this change is a separate cleanup, possible because the only
> callsite already does that match_futex() test before calling this.

No. It's possible because the state machine guarantees that. The
match_futex() in the calling function is unrelated.

> I think it might be worth splitting out, just to reduce the complexity
> of this patch.

Yes, I did by moving the match_futex() test to the call site as a
preparatory change for this one.

Thanks,

tglx