From: sashiko-bot@kernel.org
To: gregkh@linuxfoundation.org
Cc: sched-ext@lists.linux.dev
Subject: Re: Patch "sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()" has been added to the 7.0-stable tree
Date: Fri, 15 May 2026 09:39:01 +0000 [thread overview]
Message-ID: <20260515093902.D29D9C2BCB8@smtp.kernel.org> (raw)
In-Reply-To: <2026051520-oak-marlin-d109@gregkh>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unbounded iteration with interrupts disabled in `bypass_lb_cpu()` due to skipping tasks without yielding.
--
commit a8567d453e072dcdd0102db7ef988700bdb7dc40
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()
This commit updates the bypass_lb_cpu() load balancer to skip tasks that
have a stale task_rq. This prevents moving tasks between per-CPU bypass
dispatch queues without having the correct runqueue lock held.
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
[ ... ]
> @@ -4005,6 +4005,15 @@ static u32 bypass_lb_cpu(struct scx_sched *sch, struct rq *rq,
> if (cpumask_empty(donee_mask))
> break;
>
> + /*
> + * If an earlier pass placed @p on @donor_dsq from a different
> + * CPU and the donee hasn't consumed it yet, @p is still on the
> + * previous CPU and task_rq(@p) != @rq. @p can't be moved
> + * without its rq locked. Skip.
> + */
> + if (task_rq(p) != rq)
> + continue;
Does this regression lead to unbounded iteration with local interrupts
disabled?
Looking at bypass_lb_cpu(), it iterates over tasks in donor_dsq while holding
rq->lock and donor_dsq->lock. The function includes a batching mechanism to
drop these locks and prevent CPU stalls:
nr_balanced++;
if (!(nr_balanced % SCX_BYPASS_LB_BATCH) && n) {
list_move_tail(&cursor.node, &n->scx.dsq_list.node);
raw_spin_unlock(&donor_dsq->lock);
raw_spin_rq_unlock_irq(rq);
cpu_relax();
...
When tasks are skipped via the new continue statement, nr_balanced is not
incremented.
If the bypass dispatch queue contains a massive number of tasks that were
recently load-balanced but not yet consumed, they will all have a stale
task_rq.
Since they are all skipped, the loop might process an immense queue without
ever incrementing nr_balanced or triggering the lock yield.
Would it be safer to use a separate loop iteration counter rather than the
number of successfully balanced tasks to trigger the yield?
--
Sashiko AI review · https://sashiko.dev/#/patchset/2026051520-oak-marlin-d109@gregkh?part=1
prev parent reply other threads:[~2026-05-15 9:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 13:01 [PATCH 7.0.y] sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu() Andrea Righi
2026-05-14 5:02 ` sashiko-bot
2026-05-15 9:18 ` Patch "sched_ext: Skip tasks with stale task_rq in bypass_lb_cpu()" has been added to the 7.0-stable tree gregkh
2026-05-15 9:39 ` sashiko-bot [this message]
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=20260515093902.D29D9C2BCB8@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gregkh@linuxfoundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox