Re: [PATCH 1/6] sched/proxy: Remove superfluous clear_task_blocked_in()

From: K Prateek Nayak

Date: Fri May 29 2026 - 06:50:57 EST


Hello Peter,

On 5/29/2026 2:17 PM, Peter Zijlstra wrote:
> Egads, this is terrible. This means all is_blocked tasks always end up
> taking blocked_lock.
>
> The other suggestion (in the other subthread) was to simply delay this
> patch until the end. That seems far more sensible.
>
> Anyway, let me go try and find your git tree and see what you ended up> with.

Now that I look at this again, yeah, you can simply move that
optimization later too. Github isn't letting me push the branch but
essentially you move:

e2ff8b7bde07 sched/proxy: Only return migrate when needed
1b89b7b21bf5 sched/proxy: Remove superfluous clear_task_blocked_in()

to happen after commit a8be1edac5a1 ("sched/proxy: Remove
PROXY_WAKING").

All of that was for essentially this scenario:

mutex_lock()
set_task_blocked_on(mutex)
schedule_preempt_disabled()
__schedule()
p->is_blocked = 1

-------> preempted __send_signal_locked()
signal_wake_up()
try_to_wake_up()
ttwu_runnable()
/*
* Needs to clear p->blocked_on
* As long as PROXY_WAKING exists.
*/
ttwu_do_wakeup()
p->__state = TASK_RUNNING
p->is_blocked = 0

mutex_unlock()
set_task_blocked_on_waking(p, mutex)
p->blocked_on = PROXY_WAKING;

/* p->is_blocked = 0; p->blocked_on = PROXY_WAKING */

next = p;
<------ swich_in

/* Exits out of schedule_preempt_disabled() */
set_task_blocked_on(p, mutex)

!!! p->blocked_on == PROXY_WAKING !!!

--
Thanks and Regards,
Prateek