From: sashiko-bot@kernel.org
To: "Andrea Righi" <arighi@nvidia.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 07/11] sched_ext: Handle blocked donor migration with proxy execution
Date: Wed, 15 Jul 2026 21:21:35 +0000 [thread overview]
Message-ID: <20260715212136.4E36D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715205622.276220-8-arighi@nvidia.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Blocked donors are enqueued at the tail of the local DSQ, causing priority inversion.
- [High] Migrated blocked donors are routed to the BPF scheduler, breaking proxy execution visibility.
- [Medium] Spurious zero-slice warning triggered for blocked proxy donors.
--
--- Patch [7]: [PATCH 07/11] sched_ext: Handle blocked donor migration with proxy execution ---
commit 9cd5cbb0243a316aab34614eb668cef59ac84d98
Author: John Stultz <jstultz@google.com>
sched_ext: Handle blocked donor migration with proxy execution
With proxy execution enabled, mutex-blocked donors stay runnable so
their scheduling context can execute the lock owner. This patch
allows normal sched_ext migration of blocked donors unless the donor
is active on its rq, and keeps blocked donors on the local DSQ when
they are put.
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 0d2f34c79083f..abf99c582eee1 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
[ ... ]
> @@ -2395,6 +2395,19 @@ static bool task_can_run_on_remote_rq(struct scx_sched *sch,
> if (task_on_cpu(task_rq(p), p))
> return false;
>
> + /*
> + * A blocked donor may be moved normally to select a new callback rq.
> + * set_task_cpu() updates wake_cpu and makes the destination rq its new
> + * callback home, even if the donor was previously proxy-migrated.
> + *
> + * Don't move an active donor while the source rq still references it for
> + * scheduling and accounting. The migration can be retried after the donor
> + * is switched out.
> + */
> + if (p->is_blocked &&
> + rcu_access_pointer(task_rq(p)->donor) == p)
> + return false;
> +
[Severity: High]
When a blocked donor is migrated, is there a risk it gets routed to the BPF
scheduler instead of the local DSQ?
If a blocked donor is migrated via sched_setaffinity(), set_task_cpu() migrates
it and calls enqueue_task_scx() -> scx_do_enqueue_task() on the destination CPU.
Since there doesn't appear to be a check for p->is_blocked in the enqueue path,
the donor would be handed to the BPF scheduler's ops.enqueue callback.
Could the BPF scheduler then place the donor into a user or global DSQ,
violating the requirement that the donor remain immediately visible on the local
DSQ? This could cause the proxy lock owner to starve until the BPF scheduler
arbitrarily decides to dispatch the donor.
> /*
> * If @p has migration disabled, @p->cpus_ptr is updated to contain only
> * the pinned CPU in migrate_disable_switch() while @p is being switched
[ ... ]
> @@ -3081,6 +3094,22 @@ static void put_prev_task_scx(struct rq *rq, struct task_struct *p,
> if (p->scx.flags & SCX_TASK_QUEUED) {
> set_task_runnable(rq, p);
>
> + /*
> + * Mutex-blocked donors stay queued on the runqueue under proxy
> + * execution, but the donor never runs as itself, proxy-exec
> + * walks the blocked_on chain on the next __schedule() and runs
> + * the lock owner in its place.
> + *
> + * Put the donor on the local DSQ directly so pick_next_task()
> + * can still see it. find_proxy_task() will either run the chain
> + * owner or deactivate the donor so the wakeup path can return it
> + * and let BPF make a new dispatch decision once it is unblocked.
> + */
> + if (p->is_blocked) {
> + scx_dispatch_enqueue(sch, rq, &rq->scx.local_dsq, p, 0);
[Severity: High]
Does enqueuing with enq_flags = 0 place the blocked donor at the tail of the
local DSQ?
If there are other tasks already in the local DSQ (for example, dispatched by
the BPF scheduler), the donor won't be picked by pick_task_scx() until all
preceding tasks are drained.
Since proxy execution requires pick_next_task() to return the donor before
find_proxy_task() can run the lock owner, will this delay the lock owner's
execution and cause unbounded priority inversion?
Should this use SCX_ENQ_HEAD instead?
[Severity: Medium]
Will this trigger a spurious zero-slice warning if the blocked donor has
consumed its time slice?
When a blocked proxy donor consumes its time slice, task_tick_scx() calls
resched_curr() to preempt it. put_prev_task_scx() will place the donor here
directly into the local DSQ with p->scx.slice == 0.
When do_pick_task_scx() later picks it via first_local_task(), will the
unlikely(!p->scx.slice) check hit and trigger the KERN_WARNING, permanently
setting sch->warned_zero_slice to true? This would break a useful diagnostic
designed to catch BPF scheduler bugs, causing unnecessary kernel log pollution
and masking legitimate zero-slice issues.
> + goto switch_class;
> + }
> +
> /*
> * If @p has slice left and is being put, @p is getting
> * preempted by a higher priority scheduler class or core-sched
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260715205622.276220-1-arighi@nvidia.com?part=7
next prev parent reply other threads:[~2026-07-15 21:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 20:54 [PATCHSET v6 sched_ext/for-7.3] sched: Make proxy execution compatible with sched_ext Andrea Righi
2026-07-15 20:54 ` [PATCH 01/11] sched: Make NOHZ CFS bandwidth checks follow proxy donor Andrea Righi
2026-07-15 20:54 ` [PATCH 02/11] sched: Add helper to block retained proxy donors Andrea Righi
2026-07-15 20:54 ` [PATCH 03/11] sched_ext: Block proxy donors across scheduler transitions Andrea Righi
2026-07-15 20:54 ` [PATCH 04/11] sched_ext: Fix ops.running/stopping() pairing for proxy-exec donors Andrea Righi
2026-07-15 20:54 ` [PATCH 05/11] sched_ext: Fix TOCTOU race in consume_remote_task() Andrea Righi
2026-07-15 21:14 ` sashiko-bot
2026-07-15 20:54 ` [PATCH 06/11] sched_ext: Split curr|donor references properly Andrea Righi
2026-07-15 21:15 ` sashiko-bot
2026-07-15 20:54 ` [PATCH 07/11] sched_ext: Handle blocked donor migration with proxy execution Andrea Righi
2026-07-15 21:21 ` sashiko-bot [this message]
2026-07-15 20:54 ` [PATCH 08/11] sched_ext: Delegate proxy donor admission to BPF schedulers Andrea Righi
2026-07-15 20:54 ` [PATCH 09/11] sched_ext: Add selftest for blocked donor admission Andrea Righi
2026-07-15 20:54 ` [PATCH 10/11] sched_ext: scx_qmap: Add proxy execution support Andrea Righi
2026-07-15 21:35 ` sashiko-bot
2026-07-15 20:54 ` [PATCH 11/11] sched: Allow enabling proxy exec with sched_ext 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=20260715212136.4E36D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arighi@nvidia.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.