Re: [RFC PATCH v1 0/8] sched/proxy: fixes for proxy execution, with selftests

From: John Stultz

Date: Tue Nov 17 2026 - 01:29:19 EST


On Mon, Nov 16, 2026 at 11:26 AM Mathieu Desnoyers
<mathieu.desnoyers@xxxxxxxxxxxx> wrote:
>
> Hi John, Peter,
>
> This series fixes six problems of proxy execution, and adds a test
> module and a selftest for them. I found them while I looked at how
> SCHED_DEADLINE priority inheritance could move to proxy execution.
>
> It applies on top of v6 of my deadline series (link below). Patches 4
> and 6 need it: they change code that v6 adds to the deadline bandwidth
> accounting. Patches 1, 2, 3 and 5 do not.
>

Just following up again after playing with your tests and patches:

So I picked up your test-driver and kselftest patches first. Initially
with my tree, only tests 5 & 8 passed (with sched_proxy_exec enabled,
with it disabled all but 6 pass).

Now, I know this series is dependent on your deadline series, but I
figured I'd try to pull the independent changes first.

> The fixes:
>
> 1 Reschedule when a blocked task is woken under a proxy, so that the
> old owner stops running on the donor's context.

With a variation of this one, tests 1, 2, 3, 5 & 8 passed.

> 2 Wake blocked RT and deadline tasks through the full wake-up path, so
> that they are pushable and another CPU can take them.

With a variation of this one (basically dropping the shortcut rather
then special casing dl/rt tasks), tests 1-5 & 8 pass.

> 3 Stop the chain walk when the blocked_on chain is a cycle, so that a
> mutex deadlock no longer locks up the CPU.

Already have a fix for this.

> 4 Tell the class about a proxy migration, so that the load of a fair
> donor is attached to the runqueue it moves to. The bandwidth of a
> deadline donor stays in its root domain.

Have a partial fix for this already, but the deadline donor bit is
dependent on your other series.

> 5 Clear blocked_donor when the donor stops donating, so that the
> unlock path does not use a task that can be freed.

I've taken a varient of this (only clearing on proxy_needs_return() -
happy to expand that but I want to understand your reasons more) and
have some related changes to clearing blockd_donor in other cases, but
as you mentioned there's no test case in your test for this logic.

> 6 Check and admit a proxy-migrated deadline task in its own root
> domain, so that sched_setattr() no longer fails with EPERM.

This one I couldn't take as it was dependent on your other series.

Basically after the first two patches tests 6, and 7 continue to fail.
Interestingly, 7 does pass with proxy-exec off, so I need to look
closer to understand what is happening in that case that isn't
dependent on your other DL patch series.


> Points I would like your opinion on:
> - Patch 2 sends RT and deadline tasks through the full wake-up again. That
> undoes part of commit 7918cf369361 ("sched/proxy: Only return migrate
> when needed") for these classes. Putting the woken task on the pushable
> list in place would keep the optimization, but it needs a hook into
> the classes.

I'm not opposed to dropping the optimization for now, but Peter added
it so he may feel more strongly and I'd defer to him :)

> - Patch 1 reschedules for any blocked task woken on a runqueue that runs
> a proxy. A fair task woken from a delayed dequeue there also triggers
> it. That is harmless, but not free.

Agreed. Would adding the resched_curr() logic to an else statement
for the if (p->se.sched_delayed) check avoid some of this? As I
replied to the patch it also catches cases where the we're proxying
but the woken task is not part of the current chain.

> - Patch 3 also stops the donation on a ww_mutex cycle that the wound or
> die path is about to break. The donor then sleeps on its mutex.

Is this a concern or did you verify this occurs? I thought we
wound/kill tasks before the cycle gets created (see
__mutex_lock_common(), before we call set_task_blocked_on()). Maybe
I'm forgetting something?

> - Patch 4 repeats in proxy_set_task_cpu() what set_task_cpu() does
> around __set_task_cpu(). A helper shared by both would keep them from
> drifting apart. I left it out to keep the fix small.

I've already done this in my version.

Thanks again for the extra testing and sending these patches out. I'll
include the one's I've picked up in my next patch series iteration on
the list, and hopefully we can sort out the deadline bits once your DL
series has landed.

thanks
-john