From: sashiko-bot@kernel.org
To: "Tejun Heo" <tj@kernel.org>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 12/12] sched_ext: scx_qmap - Add rescue support
Date: Sat, 01 Aug 2026 09:06:02 +0000 [thread overview]
Message-ID: <20260801090603.593D51F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260801085150.2697653-13-tj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Removing the `!(enq_flags & SCX_ENQ_REENQ)` check for stranded tasks causes an infinite enqueue-reject-reenqueue loop when rescue is disabled.
--
--- Patch [12]: [PATCH 12/12] sched_ext: scx_qmap - Add rescue support ---
commit d8697209a4441d32aa069b5cede51b062fddcc4c
Author: Tejun Heo <tj@kernel.org>
sched_ext: scx_qmap - Add rescue support
This commit adds rescue support to scx_qmap for tasks that have no self cids
they can run on. It updates the qmap_enqueue and qmap_dispatch logic to use
the SCX_ENQ_RESCUE flag and scan the shared queue to redirect stranded tasks.
> diff --git a/tools/sched_ext/scx_qmap.bpf.c b/tools/sched_ext/scx_qmap.bpf.c
> index 9a0321e84e88f..b6e7b004611c0 100644
> --- a/tools/sched_ext/scx_qmap.bpf.c
> +++ b/tools/sched_ext/scx_qmap.bpf.c
> @@ -449,31 +449,33 @@ void BPF_STRUCT_OPS(qmap_enqueue, struct task_struct *p, u64 enq_flags)
> taskc->core_sched_seq = qa.core_sched_tail_seqs[idx]++;
>
> /*
> - * A node with children delegates most cids. A task of ours that can run
> - * on none of our self cids (e.g. a per-NUMA kthread pinned to delegated
> - * cids) would starve in SHARED/FIFO since we never pull those on a
> - * delegated cid. Force it onto its first allowed cid's local DSQ with
> - * needs_immed(): if we hold access there it runs, else the kernel
> - * rejects and bounces it back via REENQ_CAP. Best-effort
> - * anti-starvation nudge.
> + * A task of ours that can run on none of our self cids - the parent
> + * didn't grant them or we delegated them to children - would starve in
> + * SHARED/FIFO since we only pull from those on self cids.
> + *
> + * Force it onto its first allowed cid's local DSQ. If we hold that cid
> + * it runs. Otherwise the insert carries SCX_ENQ_RESCUE and the kernel
> + * diverts the task to its rescue path.
> */
> - if (qa.nr_sub_scheds && !(enq_flags & SCX_ENQ_REENQ) &&
> - !cmask_intersects(&taskc->cpus_allowed, &qa.self_cids.mask)) {
> + if (!cmask_intersects(&taskc->cpus_allowed, &qa.self_cids.mask)) {
[Severity: High]
Does removing the !(enq_flags & SCX_ENQ_REENQ) check here cause an
infinite bounce loop when rescue is disabled kernel-side?
If scx_qmap is executed with -B 0, the kernel capability check rejects the
insert and bounces the task back to ops.enqueue() with the SCX_ENQ_REENQ
flag.
Without the check for SCX_ENQ_REENQ, qmap_enqueue() will immediately hit
this condition again and force-insert the task back to the target CPU.
Could this lead to an endless, unthrottled loop that locks up the core?
> s32 c = cmask_next_set_wrap(&taskc->cpus_allowed, 0);
>
> if (c >= 0 && c < scx_bpf_nr_cids()) {
> taskc->force_local = false;
> + __sync_fetch_and_add(&qa.nr_rescue_dsp, 1);
> scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL_ON | c, slice_ns,
> - enq_flags | needs_immed(c));
> + enq_flags | needs_immed(c) | SCX_ENQ_RESCUE);
> return;
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260801085150.2697653-1-tj@kernel.org?part=12
next prev parent reply other threads:[~2026-08-01 9:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 8:51 [PATCHSET sched_ext/for-7.3] sched_ext: Bandwidth-limited rescue execution for stranded tasks Tejun Heo
2026-08-01 8:51 ` [PATCH 01/12] sched_ext: Rename scx_local_or_reject_dsq() to scx_resolve_local_dsq() Tejun Heo
2026-08-01 8:51 ` [PATCH 02/12] sched_ext: Make several ext.c helpers available outside ext.c Tejun Heo
2026-08-01 8:58 ` sashiko-bot
2026-08-01 8:51 ` [PATCH 03/12] sched_ext: Factor out __scx_bpf_now() Tejun Heo
2026-08-01 8:51 ` [PATCH 04/12] sched_ext: Reject internal enq_flags in the dsq move kfuncs Tejun Heo
2026-08-01 8:51 ` [PATCH 05/12] sched_ext: Make SCX_ENQ_IGNORE_CAPS waive the preemption cap too Tejun Heo
2026-08-01 8:51 ` [PATCH 06/12] sched_ext: Synchronize slice and dsq_vtime writes Tejun Heo
2026-08-01 8:51 ` [PATCH 07/12] sched_ext: Add SCX_TASK_PROTECTED Tejun Heo
2026-08-01 8:51 ` [PATCH 08/12] sched_ext: Add bandwidth-limited rescue execution for stranded tasks Tejun Heo
2026-08-01 8:51 ` [PATCH 09/12] sched_ext: Eject the top rescue consumer on overload Tejun Heo
2026-08-01 9:11 ` sashiko-bot
2026-08-01 8:51 ` [PATCH 10/12] sched_ext: Sync tools autogen enum headers Tejun Heo
2026-08-01 8:51 ` [PATCH 11/12] sched_ext: scx_qmap - Idle-check pinned tasks before direct dispatch Tejun Heo
2026-08-01 9:06 ` sashiko-bot
2026-08-01 8:51 ` [PATCH 12/12] sched_ext: scx_qmap - Add rescue support Tejun Heo
2026-08-01 9:06 ` sashiko-bot [this message]
2026-08-02 19:51 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2026-08-02 21:54 [PATCHSET v2 sched_ext/for-7.3] sched_ext: Bandwidth-limited rescue execution for stranded tasks Tejun Heo
2026-08-02 21:54 ` [PATCH 12/12] sched_ext: scx_qmap - Add rescue support Tejun Heo
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=20260801090603.593D51F00AC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
/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