Re: [RFC PATCH 07/11] sched: Add proxy execution

From: Peter Zijlstra
Date: Sat Oct 15 2022 - 11:08:38 EST


On Mon, Oct 03, 2022 at 09:44:57PM +0000, Connor O'Brien wrote:
> @@ -965,7 +1026,10 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
> if (owner & MUTEX_FLAG_HANDOFF)
> __mutex_handoff(lock, next);
>
> - preempt_disable();
> + preempt_disable(); /* XXX connoro: why disable preemption here? */
> +#ifdef CONFIG_PROXY_EXEC
> + raw_spin_unlock(&current->blocked_lock);
> +#endif
> raw_spin_unlock_irqrestore(&lock->wait_lock, flags);

Because if we wouldn't have preemption disabled it would preempt here,
before the wakeup:

> wake_up_q(&wake_q);

And you'd be stuck with a priority inversion.