Re: [PATCH v34 03/14] sched/proxy: Reschedule when a blocked task is woken under a proxy

From: K Prateek Nayak

Date: Wed Dec 02 2026 - 01:50:11 EST


Hello John,

On 12/2/2026 12:02 PM, John Stultz wrote:
>>> So just that I'm understanding you properly, the idea is just to
>>> rework the logic currently done under the blocked_lock, so after the
>>> patches in this series, proxy_needs_return() would look like:
>>>
>>> {
>>> proxy_clear_curr_donor(rq, p);
>>> if (rq->donor != rq->curr)
>>> resched_curr(rq);
>>>
>>> if (task_current(rq, p))
>>> return false;
>>>
>>> if (task_cpu(p) == p->wake_cpu && !rt_or_dl_task(p))
>>> return false;
>>>
>>> if (task_current_donor(rq, p))
>>> proxy_reset_donor(rq);
>>>
>>> clear_task_blocked_on(p, NULL);
>>> block_task(rq, p, TASK_WAKING, 0);
>>> }
>>>
>>> ?
>>
>> Almost! what I thought looks like:
>>
>> {
>> if (task_current(rq, p))
>> return false;
>>
>> if (task_current_donor(rq, p))
>> proxy_reset_donor(rq); /* Do proxy_clear_curr_donor() within */
>
> I don't think that would work. If there'a a chain A->B->C where A is
> the donor, and C is curr. If B wakes up, we need to do the
> proxy_clear_curr_donor() (since its C's->blocked_donor).
>
> If we hide that under a task_current_donor() conditional, we'll only
> call it if p==A.
>
> Also, your example skipped the:
> if (rq->donor != rq->curr)
> resched_curr(rq);
>
> bit which is what the patch at the start of this thread is focused on.

Ah! I see. So any part of chain currently proxying should
call a resched and it is not trivial to detect that chain
from that one wakeup without some from of traversal.

I completely missed that. Thank you for patiently explaining
the problem!

>> if (task_cpu(p) == p->wake_cpu && !rt_or_dl_task(p))
>> return false;
>>
>> clear_task_blocked_on(p, NULL);
>> block_task(rq, p, TASK_WAKING, 0);
>> }
>>
>>> I'll give that a shot here.
>>>
>>> I'm wondering if a if (!sched_proxy_exec()) return; shortcut at the
>>> top might be nice too since we may not want to trip up the rt/dl task
>>> case and do all the work, but I know Peter wasn't happy with that
>>> being sprinkled around.
>>
>> Ack! That makes sense given the rt_or_dl_task() condition.
>
> I'll add that in as well then. The reordering/reworking the logic
> feels separate enough I'll do it in a separate patch from the original
> change here from Mathieu.
>
> thanks
> -john

--
Thanks and Regards,
Prateek