Re: [RFC PATCH 06/16] sched/core: Queue blocked donor onto sleeping owner for chain-wakeup

From: K Prateek Nayak

Date: Wed Aug 26 2026 - 23:52:11 EST


Hello Andrea,

On 8/26/2026 9:50 PM, Andrea Righi wrote:
>> +static void proxy_enqueue_on_owner(struct rq *rq, struct task_struct *owner,
>> + struct task_struct *p)
>> +{
>> + lockdep_assert_rq_held(rq);
>> + lockdep_assert_held(&owner->blocked_lock);
>> +
>> + WARN_ON(!p->on_rq);
>> + WARN_ON(p->sleeping_owner);
>> +
>> + WRITE_ONCE(p->sleeping_owner, owner);
>> + list_add(&p->blocked_node, &owner->blocked_head);
>> + proxy_resched_idle(rq);
>> +
>> + /*
>> + * Order against __activate_blocked_task_slowpath() checking
>> + * owner->blocked_list after setting owner->on_rq.
>
> This should be owner->blocked_head not owner->blocked_list, right?

Correct! My bad. Also the slow-path is proxy_activate_blocked_task()
that gets introduced in Patch 14. I missed renaming it here.

And ack on other comments too above.

>
>> + */
>> + smp_mb();
>> +
>> + if (READ_ONCE(owner->on_rq)) {
>> + /*
>> + * owner has woken up and may miss activating us.
>> + * Remove ourself from "owner->blocked_head" and try
>> + * find_proxy_task() again considering the owner's
>> + * new state.
>> + */
>> + __proxy_dequeue_from_owner(p);
>> + return;
>> + }
>> +
>> + /*
>> + * Owner is fully blocked. __activate_blocked_task_slowpath()
>> + * will see us on the list during wakeup and DTRT.
>> + */
>> + block_task(rq, p, READ_ONCE(p->__state));
>> +}

--
Thanks and Regards,
Prateek