Re: [PATCH 1/2] futex/requeue: Fix rtmutex schedule preparation for requeue PI

From: Sebastian Andrzej Siewior

Date: Tue Jul 21 2026 - 05:51:02 EST


On 2026-07-21 17:02:11 [+0800], Yao Kai wrote:
>
> Unless I am missing something, spin_lock() does not use the regular
> rt_mutex pre/schedule/post sequence on PREEMPT_RT. Its contended path
> uses schedule_rtlock():
>
> spin_lock()
> rt_spin_lock()
> _rt_spin_lock()
> rtlock_lock()
> lockdep_assert(!current->pi_blocked_on);
> rtlock_slowlock()
> rtlock_slowlock_locked()
> schedule_rtlock()
>
> At this point current->pi_blocked_on has already been cleared ,so the
> assertion in rtlock_lock() is also satisfied.

Ach right. We don't do this for spinlock_t but for everything
non-spinning on !RT. So it should be fine.

> That said, I think it is also acceptable to place
> rt_mutex_post_schedule() immediately after rt_mutex_wait_proxy_lock().

We delay it in futex_lock_pi() for other reasons. You could push down
after debug_rt_mutex_free_waiter() but I don't see the reason for it.

Having only where it is needed with a short comment why it is needed,
would be appreciated :)

> Yao

Sebastian