From: Andrea Righi <arighi@nvidia.com>
To: John Stultz <jstultz@google.com>
Cc: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
Christian Loehle <christian.loehle@arm.com>,
David Dai <david.dai@linux.dev>, Koba Ko <kobak@nvidia.com>,
Aiqun Yu <aiqun.yu@oss.qualcomm.com>,
Shuah Khan <shuah@kernel.org>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/11] sched_ext: Delegate proxy donor admission to BPF schedulers
Date: Tue, 21 Jul 2026 06:54:28 +0200 [thread overview]
Message-ID: <al77hBqrJlr1_4Qw@gpd4> (raw)
In-Reply-To: <CANDhNCrKXY3pTcsK4bSdeMRyUPjzdB+FBwF9A+p-djQ0TxCirw@mail.gmail.com>
On Mon, Jul 20, 2026 at 05:37:29PM -0700, John Stultz wrote:
> On Mon, Jul 20, 2026 at 9:02 AM Andrea Righi <arighi@nvidia.com> wrote:
> > On Sat, Jul 18, 2026 at 04:23:40PM +0200, Andrea Righi wrote:
> > > On Fri, Jul 17, 2026 at 11:50:20PM -0700, John Stultz wrote:
> > > > I'll work to prove this out a bit further next week. I suspect we'll
> > > > need something somewhere between activate_blocked_waiters() ->
> > > > scx_do_enqueue_task() to skip enquing of is_blocked tasks when
> > > > SCX_OPS_ENQ_BLOCKED isn't set.
> > >
> > > Your theory looks correct to me. I was also able to reproduce this. I think the
> > > problem is that scx_prepare_task_sched_change() calls sched_proxy_block_task(),
> > > but the latter has nothing to do when the donor is already off the runqueue
> > > behind a sleeping owner.
> > >
> > > When the owner subsequently wakes, activate_blocked_waiters() unconditionally
> > > reactivates the donor while is_blocked is still set. Since this activation
> > > carries ENQUEUE_WAKEUP, sched_ext treats it as a normal wakeup rather than a
> > > blocked-donor admission. The donor can therefore enter an scx scheduler that
> > > doesn't set SCX_OPS_ENQ_BLOCKED (scx_pair in this case), eventually triggering
> > > the warning in put_prev_task_scx(): unexpected proxy donor without
> > > SCX_OPS_ENQ_BLOCKED set.
> > >
> > > I think we can fix this by checking scx_allow_proxy_exec() in
> > > do_activate_blocked_waiter() before reactivating the donor. If the scx scheduler
> > > doesn't support proxy donors (SCX_OPS_ENQ_BLOCKED not set), the task should
> > > remain blocked and will be activated normally by the mutex wakeup.
> > >
> > > While looking at this, I noticed another issue in the same path:
> > > activate_blocked_waiters() currently passes ENQUEUE_WAKEUP because the generic
> > > scheduling classes need wakeup-style enqueue accounting. However, this is not a
> > > real mutex wakeup, the donor remains blocked and is only being made runnable so
> > > that it can donate its scheduling context.
> > >
> > > As a result, even a scheduler that sets SCX_OPS_ENQ_BLOCKED currently receives
> > > this sleeping-owner activation as SCX_ENQ_WAKEUP rather than SCX_ENQ_BLOCKED.
> > > That's because the existing sched_ext test:
> > >
> > > p->is_blocked && !(enq_flags & SCX_ENQ_WAKEUP)
> > >
> > > doesn't distinguish a genuine mutex wakeup from this proxy activation.
> > >
> > > Maybe we can address this by adding an internal ENQUEUE_PROXY flag to the
> > > sleeping-owner activation. The generic classes will continue to see
> > > ENQUEUE_WAKEUP, preserving their accounting behavior, while sched_ext will use
> > > ENQUEUE_PROXY to expose the event to BPF as SCX_ENQ_BLOCKED without
> > > SCX_ENQ_WAKEUP. And a genuine mutex wakeup will continue to be reported as
> > > SCX_ENQ_WAKEUP. What do you think?
> >
> > FYI, I've applied your sleeping owner changes + the scx-proxy-exec patch series
> > with the changes mentioned above here:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/arighi/linux.git scx-proxy-exec-next
> >
> > Everything looks good on my side so far.
>
> That's awesome! Thank you for your efforts here! I'll start testing
> and playing around with this branch!
>
> Though, looking at your patch stack, I'd rather not make my patches
> under review a dependency for your patches. Peter has not yet put his
> laser-eyes upon my series so there's no telling how much rework they
> may need (and it does have some subtle parts that I'm sure he'll have
> feedback on). So just to allow your current series to be able to move
> foward, would it make sense if I added your "sched: Distinguish proxy
> activations from wakeups" patch to the end of my series? It looks
> like there's not much interlock on the rest of your changes (though
> I've not carefully reviewed the diff from your scx-proxy-exec branch
> as they are on different bases), so maybe that would just work and the
> rest of your series could move forward?
Sounds like a good plan! It'd be helpful if you could include
"sched: Distinguish proxy activations from wakeups" at the end of your
sleeping-owner series.
I'll move the combined version to scx-proxy-exec-sleeping-owner for testing and
rebase the scx-proxy-exec series without the sleeping-owner changes, so that it
can move forward independently for now.
Thanks!
-Andrea
next prev parent reply other threads:[~2026-07-21 4:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 13:20 [PATCHSET v7 sched_ext/for-7.3] sched: Make proxy execution compatible with sched_ext Andrea Righi
2026-07-16 13:20 ` [PATCH 01/11] sched: Make NOHZ CFS bandwidth checks follow proxy donor Andrea Righi
2026-07-18 3:11 ` John Stultz
2026-07-16 13:20 ` [PATCH 02/11] sched: Add helper to block retained proxy donors Andrea Righi
2026-07-16 13:20 ` [PATCH 03/11] sched_ext: Block proxy donors across scheduler transitions Andrea Righi
2026-07-18 3:16 ` John Stultz
2026-07-16 13:20 ` [PATCH 04/11] sched_ext: Fix ops.running/stopping() pairing for proxy-exec donors Andrea Righi
2026-07-16 13:20 ` [PATCH 05/11] sched_ext: Fix TOCTOU race in consume_remote_task() Andrea Righi
2026-07-16 21:29 ` Tejun Heo
2026-07-16 21:38 ` Tejun Heo
2026-07-17 6:35 ` Andrea Righi
2026-07-16 13:20 ` [PATCH 06/11] sched_ext: Split curr|donor references properly Andrea Righi
2026-07-16 13:20 ` [PATCH 07/11] sched_ext: Handle blocked donor migration with proxy execution Andrea Righi
2026-07-16 13:20 ` [PATCH 08/11] sched_ext: Delegate proxy donor admission to BPF schedulers Andrea Righi
2026-07-18 6:16 ` John Stultz
2026-07-18 6:50 ` John Stultz
2026-07-18 14:23 ` Andrea Righi
2026-07-20 16:01 ` Andrea Righi
2026-07-21 0:37 ` John Stultz
2026-07-21 4:54 ` Andrea Righi [this message]
2026-07-21 5:15 ` John Stultz
2026-07-16 13:20 ` [PATCH 09/11] sched_ext: Add selftest for blocked donor admission Andrea Righi
2026-07-16 13:20 ` [PATCH 10/11] sched_ext: scx_qmap: Add proxy execution support Andrea Righi
2026-07-18 2:28 ` John Stultz
2026-07-18 5:47 ` Andrea Righi
2026-07-18 6:04 ` John Stultz
2026-07-18 8:24 ` Andrea Righi
2026-07-21 3:39 ` John Stultz
2026-07-16 13:20 ` [PATCH 11/11] sched: Allow enabling proxy exec with sched_ext Andrea Righi
-- strict thread matches above, loose matches on Subject: below --
2026-07-15 20:54 [PATCHSET v6 sched_ext/for-7.3] sched: Make proxy execution compatible " Andrea Righi
2026-07-15 20:54 ` [PATCH 08/11] sched_ext: Delegate proxy donor admission to BPF schedulers Andrea Righi
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=al77hBqrJlr1_4Qw@gpd4 \
--to=arighi@nvidia.com \
--cc=aiqun.yu@oss.qualcomm.com \
--cc=bsegall@google.com \
--cc=changwoo@igalia.com \
--cc=christian.loehle@arm.com \
--cc=david.dai@linux.dev \
--cc=dietmar.eggemann@arm.com \
--cc=jstultz@google.com \
--cc=juri.lelli@redhat.com \
--cc=kobak@nvidia.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sched-ext@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=void@manifault.com \
--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®