Re: [RFC PATCH 02/12] futex: Switch PI futex to use p->pi_futex_lock instead of p->pi_lock.

From: Suleiman Souhlal

Date: Fri Sep 18 2026 - 03:12:01 EST


On Fri, Sep 18, 2026 at 12:38 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Thu, Sep 17, 2026 at 04:33:26AM +0000, Suleiman Souhlal wrote:
> > Switch PI futexes to use p->pi_futex_lock instead of p->pi_lock.
> >
> > When augmenting PING futexes with proxy execution, we get lock order
> > inversions, due to the lock order being p->pi_lock -> mutex->wait_lock
> > in the scheduler, but wait_lock -> p->pi_lock in futex code.
> >
> > So move the futex code to use a new lock, p->pi_futex_lock, to
> > protect p->pi_state_list and pi_state->owner.
>
> This is of course horrible. Lets not do this.

I suppose the alternatives would be to either figure out how to
un-nest pi_lock from wait_lock in futex code or un-nesting the
blocked_on lock from pi_lock in the scheduler.
Either of them seemed more involved than creating a new lock, but
maybe I was wrong.
I will take another look.

-- Suleiman