From: sashiko-bot@kernel.org
To: "Andrea Righi" <arighi@nvidia.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 1/2] sched_ext: Add lazy preemption support
Date: Mon, 14 Sep 2026 14:58:23 +0000 [thread overview]
Message-ID: <20260914145824.3EDAA1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914144620.2032614-2-arighi@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] SCX_KICK_WAIT synchronization fails permanently when combined with SCX_KICK_PREEMPT_LAZY because the synchronization return flag is completely discarded.
--
commit 9fb7f95cc0c5449c9ecc76666403b400b99be566
Author: Andrea Righi <arighi@nvidia.com>
sched_ext: Add lazy preemption support
This commit introduces lazy preemption support for sched_ext by adding
SCX_ENQ_PREEMPT_LAZY and SCX_KICK_PREEMPT_LAZY. It updates the tick logic
and dispatch queues to handle lazy rescheduling correctly while preserving
precedence for immediate preemption and wait requests.
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
[ ... ]
> @@ -8572,6 +8624,14 @@ static void kick_cpus_irq_workfn(struct irq_work *irq_work)
> cpumask_clear_cpu(cpu, pcpu->cpus_to_kick_if_idle);
> }
>
> + /*
> + * kick_one_cpu() clears the lazy bit of every cpu it visited
> + * above; visit the remaining requests which contain lazy
> + * preemption, see scx_kick_cpu().
> + */
> + for_each_cpu(cpu, pcpu->cpus_to_preempt_lazy)
> + kick_one_cpu(cpu, pcpu, this_rq, ksyncs);
[Severity: High]
When SCX_KICK_WAIT is combined with SCX_KICK_PREEMPT_LAZY, does this
discard the wait synchronization requirement?
kick_one_cpu() returns a boolean indicating whether synchronization is
required. In the primary loop above, the result is accumulated into
should_wait, but here the return value is ignored. If a CPU is only
processed in this lazy preemption loop, the caller might proceed
prematurely, breaking the SCX_KICK_WAIT guarantees.
[ ... ]
> @@ -9591,12 +9683,15 @@ void scx_kick_cpu(struct scx_sched *sch, s32 cpu, u64 flags)
> }
> cpumask_set_cpu(cpu, pcpu->cpus_to_kick_if_idle);
> } else {
> - cpumask_set_cpu(cpu, pcpu->cpus_to_kick);
> -
> + /* Accumulate requests and resolve their precedence at delivery. */
> if (flags & SCX_KICK_PREEMPT)
> cpumask_set_cpu(cpu, pcpu->cpus_to_preempt);
> + if (flags & SCX_KICK_PREEMPT_LAZY)
> + cpumask_set_cpu(cpu, pcpu->cpus_to_preempt_lazy);
> if (flags & SCX_KICK_WAIT)
> cpumask_set_cpu(cpu, pcpu->cpus_to_wait);
> + if (!(flags & SCX_KICK_PREEMPT_LAZY))
> + cpumask_set_cpu(cpu, pcpu->cpus_to_kick);
[Severity: High]
Does skipping the assignment to cpus_to_kick when SCX_KICK_PREEMPT_LAZY
is set force the CPU to be processed exclusively in the secondary loop in
kick_cpus_irq_workfn()?
Because the CPU is omitted from cpus_to_kick here, it bypasses the primary
loop where should_wait is accumulated. Instead, it gets handled entirely
in the cpus_to_preempt_lazy loop where the return value of kick_one_cpu()
is ignored, preventing the wait request from being properly respected.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914144620.2032614-1-arighi@nvidia.com?part=1
next prev parent reply other threads:[~2026-09-14 14:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 14:44 [PATCHSET v3 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-14 14:44 ` [PATCH 1/2] " Andrea Righi
2026-09-14 14:58 ` sashiko-bot [this message]
2026-09-14 14:44 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-14 14:59 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-09-18 17:13 [PATCHSET v7 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-18 17:13 ` [PATCH 1/2] " Andrea Righi
2026-09-17 7:02 [PATCHSET v6 sched_ext/for-7.4] " Andrea Righi
2026-09-17 7:02 ` [PATCH 1/2] " Andrea Righi
2026-09-17 19:19 ` Tejun Heo
2026-09-18 6:27 ` Andrea Righi
2026-09-18 3:35 ` Tao Cui
2026-09-18 6:37 ` Andrea Righi
2026-09-15 19:45 [PATCHSET v5 sched_ext/for-7.4] " Andrea Righi
2026-09-15 19:45 ` [PATCH 1/2] " Andrea Righi
2026-09-15 19:57 ` sashiko-bot
2026-09-15 20:09 ` Andrea Righi
2026-09-16 21:03 ` Tejun Heo
2026-09-15 9:00 [PATCHSET v4 sched_ext/for-7.4] " Andrea Righi
2026-09-15 9:00 ` [PATCH 1/2] " Andrea Righi
2026-09-14 8:47 [PATCHSET v2 sched_ext/for-7.4] " Andrea Righi
2026-09-14 8:47 ` [PATCH 1/2] " Andrea Righi
2026-09-14 9:06 ` sashiko-bot
2026-09-14 12:18 ` Andrea Righi
2026-09-11 19:56 [PATCHSET sched_ext/for-7.4] " Andrea Righi
2026-09-11 19:56 ` [PATCH 1/2] " Andrea Righi
2026-09-13 16:50 ` Tejun Heo
2026-09-14 6:05 ` 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=20260914145824.3EDAA1F000FF@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox