mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: John Stultz <jstultz@google.com>
Cc: peterz@infradead.org, mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, linux-kernel@vger.kernel.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	kprateek.nayak@amd.com, arighi@nvidia.com,
	akpm@linux-foundation.org, shuah@kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/8] sched/proxy: Reschedule when a blocked task is woken under a proxy
Date: Tue, 17 Nov 2026 08:18:38 -0500	[thread overview]
Message-ID: <c04e2868-1f78-43ce-9425-54c8ca42a98a@efficios.com> (raw)
In-Reply-To: <CANDhNCqmsDUC1hx6GnB_2ROQ2rYm3wKYfnbkVAuAjecducsSsQ@mail.gmail.com>

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

  reply	other threads:[~2026-11-17 13:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 19:26 [RFC PATCH v1 0/8] sched/proxy: fixes for proxy execution, with selftests Mathieu Desnoyers
2026-11-16 19:26 ` [RFC PATCH v1 1/8] sched/proxy: Reschedule when a blocked task is woken under a proxy Mathieu Desnoyers
2026-11-16 21:12   ` John Stultz
2026-11-17 13:18     ` Mathieu Desnoyers [this message]
2026-11-16 19:26 ` [RFC PATCH v1 2/8] sched/proxy: Wake blocked RT and deadline tasks through the full path Mathieu Desnoyers
2026-11-16 21:35   ` John Stultz
2026-11-17 13:19     ` Mathieu Desnoyers
2026-11-16 19:26 ` [RFC PATCH v1 3/8] sched/proxy: Stop the chain walk when the blocked_on chain is a cycle Mathieu Desnoyers
2026-11-16 20:36   ` John Stultz
2026-11-16 19:26 ` [RFC PATCH v1 4/8] sched/proxy: Tell the class about a proxy migration Mathieu Desnoyers
2026-11-16 20:42   ` John Stultz
2026-11-17 13:20     ` Mathieu Desnoyers
2026-11-16 19:26 ` [RFC PATCH v1 5/8] sched/proxy: Clear blocked_donor when the donor stops donating Mathieu Desnoyers
2026-11-16 23:16   ` John Stultz
2026-11-17 13:22     ` Mathieu Desnoyers
2026-11-16 19:26 ` [RFC PATCH v1 6/8] sched/deadline: Use the root domain a proxy-migrated task runs in Mathieu Desnoyers
2026-11-16 19:26 ` [RFC PATCH v1 7/8] lib: Add test_proxy_exec, kernel mutexes that user space can hold Mathieu Desnoyers
2026-11-16 19:26 ` [RFC PATCH v1 8/8] selftests/sched: Add tests of proxy execution Mathieu Desnoyers
2026-11-16 20:27 ` [RFC PATCH v1 0/8] sched/proxy: fixes for proxy execution, with selftests John Stultz
2026-11-17  6:28 ` John Stultz
2026-11-17 13:16   ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c04e2868-1f78-43ce-9425-54c8ca42a98a@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®