Sched_ext development
 help / color / mirror / Atom feed
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: Tue, 15 Sep 2026 19:57:52 +0000	[thread overview]
Message-ID: <20260915195752.80F431F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915194611.2674127-2-arighi@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] sched_ext: redundant idle kick processing for lazy preemptions
--

commit 42fa214a424ea8999256e25137769c2bfce81537
Author: Andrea Righi <arighi@nvidia.com>
sched_ext: Add lazy preemption support

This commit adds lazy preemption support to sched_ext, allowing BPF
schedulers to request deferred rescheduling. It introduces new enqueue and
kick flags for lazy preemption, and updates the task slice expiry logic.

> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index f875c50f00bbe..819995667cc26 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
[ ... ]
> @@ -8574,6 +8626,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)
> +			should_wait |= kick_one_cpu(cpu, pcpu, this_rq, ksyncs);
> +

[Severity: Low]
Does this loop in kick_cpus_irq_workfn() intentionally skip clearing
cpus_to_kick_if_idle for the CPUs it processes?

If a BPF scheduler issues both an idle kick and a lazy preemption kick on
the same target within a narrow window, but without a non-lazy kick, the
target CPU is serviced by this loop. 

Because this loop fails to clear cpus_to_kick_if_idle for the visited CPU,
the subsequent idle loop immediately below it will redundantly lock and
evaluate the same CPU again. 

Could this cause a minor performance inefficiency due to the redundant
evaluation, and should cpumask_clear_cpu(cpu, pcpu->cpus_to_kick_if_idle)
be added here as well?

>  		for_each_cpu(cpu, pcpu->cpus_to_kick_if_idle) {
>  			kick_one_cpu_if_idle(cpu, pcpu, this_rq);
>  			cpumask_clear_cpu(cpu, pcpu->cpus_to_kick_if_idle);
>  		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915194611.2674127-1-arighi@nvidia.com?part=1

  reply	other threads:[~2026-09-15 19:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 19:45 [PATCHSET v5 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-15 19:45 ` [PATCH 1/2] " Andrea Righi
2026-09-15 19:57   ` sashiko-bot [this message]
2026-09-15 20:09     ` Andrea Righi
2026-09-16 21:03   ` Tejun Heo
2026-09-15 19:45 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-16 21:03   ` Tejun Heo
  -- 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  9:00 [PATCHSET v4 sched_ext/for-7.4] " Andrea Righi
2026-09-15  9:00 ` [PATCH 1/2] " Andrea Righi
2026-09-14 14:44 [PATCHSET v3 sched_ext/for-7.4] " Andrea Righi
2026-09-14 14:44 ` [PATCH 1/2] " Andrea Righi
2026-09-14 14:58   ` sashiko-bot
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=20260915195752.80F431F000FF@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