Re: [RFC PATCH v1 1/8] sched/proxy: Reschedule when a blocked task is woken under a proxy

From: Mathieu Desnoyers

Date: Tue Nov 17 2026 - 08:18:50 EST


On 2026-11-16 16:12, John Stultz wrote:
> Both the comment and the commit message are also confusing, as if at
> the start of ttwu_runnable() if p is the donor, proxy_needs_return()
> will have called proxy_reset_donor(), setting rq->donor = rq->curr
> (and already calling resched_curr()).

Only when the donor was proxy-migrated. When the donor is still on its
own CPU, task_cpu(p) == p->wake_cpu. proxy_needs_return() then returns
false at its first check, before proxy_reset_donor(). That is the case
the commit message describes: the owner was on the donor's CPU, so no
proxy migration happened. handoff_fifo hits it on one CPU.

Once the shortcut is gone, as you propose for patch 2, the donor goes
through proxy_reset_donor(). Then this patch only matters for a task
in the middle of the chain.

> So it seems this patch is mainly trying to handle the case of a
> mid-chain wakeup, where p isn't the current donor, but is in the
> current chain? I agree that looks to be a problem, but the donor !=
> curr check just is testing that we are proxying, not that p is in the
> active chain.

Yes. All the tasks of the running chain are on this runqueue:
find_proxy_task() migrates the donor when an owner is on another CPU.
So a woken chain member is always seen here. A blocked task outside the
chain also triggers the reschedule. I found no cheap test for chain
membership.

> Though it feels like maybe the check should be pushed into
> proxy_needs_return() instead so it can be more clearly aligned with
> the similar proxy_reset_donor() call?

Agreed. Without the shortcut, this would be an else of the
task_current_donor() check:

if (task_current_donor(rq, p))
proxy_reset_donor(rq);
else if (rq->donor != rq->curr)
resched_curr(rq);

I tried this on your proxy-exec-v33-7.4-pre-rc1 branch: no shortcut,
and this else branch. Cases 1 to 4 then pass, in 3 runs of 3. No case
wakes a task in the middle of the chain, so the else branch itself is
not tested.

Your suggestion on the cover letter also fits. On tip, a task woken
from a delayed dequeue is never in the running chain: find_proxy_task()
stops at a delayed owner. So the reschedule can be skipped for it.

Thanks,

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com