Re: [PATCH 0/6] locking/rtmutex: Avoid PI state recursion through sched_submit_work()

From: Sebastian Andrzej Siewior
Date: Wed Aug 16 2023 - 11:26:30 EST


On 2023-08-16 17:22:31 [+0200], Peter Zijlstra wrote:
> On Wed, Aug 16, 2023 at 04:58:18PM +0200, Peter Zijlstra wrote:
>
> > I've ended up with the below, but it is quite horrible.. but let me go
> > stare at the futex wreckage before trying to clean things up.
>
> OK, I think the below covers the simple case, now lets see if I can make
> sense of futex_wait_requeue_pi()... :/
>
> ---
> --- a/kernel/futex/pi.c
> +++ b/kernel/futex/pi.c
> @@ -1002,6 +1002,12 @@ int futex_lock_pi(u32 __user *uaddr, uns
> goto no_block;
> }
>
> + /*
> + * Must be done before we enqueue the waiter, here is unfortunately
> + * under the hb lock, but that *should* work.
> + */
> + rt_mutex_pre_schedule();

but this will do sched_submit_work() which you don't need for futex at
all. It should be a nop (as in nothing will happen) but still.

> rt_mutex_init_waiter(&rt_waiter);
>
> /*

Sebastian