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 02/12] sched: Make NOHZ CFS bandwidth checks follow proxy donor
Date: Tue, 21 Jul 2026 07:13:58 +0000	[thread overview]
Message-ID: <20260721071358.E44411F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721063242.552774-3-arighi@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The patch fails to remove the `rq->nr_running != 1` restriction from `sched_fair_update_stop_tick()`, leaving proxy execution bandwidth enforcement broken during context switches.
--

--- Patch [2]: [PATCH 02/12] sched: Make NOHZ CFS bandwidth checks follow proxy donor ---
commit 4af18b2dbe3d9116ee4049aa70ca4c8662c0104c
Author: Andrea Righi <arighi@nvidia.com>

sched: Make NOHZ CFS bandwidth checks follow proxy donor

Proxy execution separates the scheduling context in rq->donor from the
physical execution context in rq->curr. sched_can_stop_tick() checks the
latter for CFS bandwidth constraints and only does so when nr_running is
one. A retained proxy donor keeps both the donor and mutex owner queued,
so this patch checks the selected donor instead and removes the
nr_running restriction.

Link: https://lore.kernel.org/r/20260713164807.E5ED21F00A3A@smtp.kernel.org

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index f788b72d1bfff..35d41d45e365e 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1409,11 +1409,8 @@ static void nohz_csd_func(void *info)
>  #endif /* CONFIG_NO_HZ_COMMON */
>  
>  #ifdef CONFIG_NO_HZ_FULL
> -static inline bool __need_bw_check(struct rq *rq, struct task_struct *p)
> +static inline bool __need_bw_check(struct task_struct *p)
>  {
> -	if (rq->nr_running != 1)
> -		return false;
> -

[Severity: High]
This is a pre-existing issue, but does removing this restriction here fully
resolve the proxy execution bandwidth enforcement bug?

Looking at sched_fair_update_stop_tick() in kernel/sched/fair.c, there is an
identical check that prevents tick updates when nr_running != 1:

kernel/sched/fair.c:sched_fair_update_stop_tick() {
	if (rq->nr_running != 1)
		return;
	...
}

If a constrained FAIR task donates its scheduling context to a lower-priority
task (like an SCX task) via proxy execution, nr_running becomes >= 2 while
h_nr_queued remains 1.

During enqueue, sched_can_stop_tick() evaluates against the old rq->donor
(e.g., the idle task) and may clear the tick dependency. When the scheduler
picks the FAIR donor, sched_fair_update_stop_tick() returns early because
rq->nr_running != 1.

Can this result in the tick remaining cleared, allowing a constrained FAIR
task to bypass its CFS bandwidth quota?

Should the nr_running restriction in sched_fair_update_stop_tick() also be
removed or updated to properly account for proxy execution?

>  	if (p->sched_class != &fair_sched_class)
>  		return false;
>

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

  reply	other threads:[~2026-07-21  7:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  6:31 [PATCHSET v8 sched_ext/for-7.3] sched: Make proxy execution compatible with sched_ext Andrea Righi
2026-07-21  6:31 ` [PATCH 01/12] sched/core: Avoid false migration warning for proxy donors Andrea Righi
2026-07-21  6:50   ` sashiko-bot
2026-07-21  7:00   ` John Stultz
2026-07-21  7:34     ` Andrea Righi
2026-07-21  6:31 ` [PATCH 02/12] sched: Make NOHZ CFS bandwidth checks follow proxy donor Andrea Righi
2026-07-21  7:13   ` sashiko-bot [this message]
2026-07-21  6:31 ` [PATCH 03/12] sched: Add helper to block retained proxy donors Andrea Righi
2026-07-21  7:02   ` John Stultz
2026-07-21  6:31 ` [PATCH 04/12] sched_ext: Block proxy donors across scheduler transitions Andrea Righi
2026-07-22 23:26   ` Tejun Heo
2026-07-23 16:47     ` Andrea Righi
2026-07-21  6:31 ` [PATCH 05/12] sched_ext: Fix ops.running/stopping() pairing for proxy-exec donors Andrea Righi
2026-07-22 23:26   ` Tejun Heo
2026-07-21  6:31 ` [PATCH 06/12] sched_ext: Fix proxy-exec race in consume_remote_task() Andrea Righi
2026-07-21  7:09   ` John Stultz
2026-07-21  7:51   ` sashiko-bot
2026-07-22 23:26   ` Tejun Heo
2026-07-21  6:31 ` [PATCH 07/12] sched_ext: Split curr|donor references properly Andrea Righi
2026-07-21  8:13   ` sashiko-bot
2026-07-21  6:31 ` [PATCH 08/12] sched_ext: Handle blocked donor migration with proxy execution Andrea Righi
2026-07-21  8:42   ` sashiko-bot
2026-07-21  6:31 ` [PATCH 09/12] sched_ext: Delegate proxy donor admission to BPF schedulers Andrea Righi
2026-07-22 23:26   ` Tejun Heo
2026-07-21  6:31 ` [PATCH 10/12] sched_ext: Add selftest for blocked donor admission Andrea Righi
2026-07-21  6:31 ` [PATCH 11/12] sched_ext: scx_qmap: Add proxy execution support Andrea Righi
2026-07-21  6:31 ` [PATCH 12/12] sched: Allow enabling proxy exec with sched_ext Andrea Righi
2026-07-21  7:05   ` John Stultz

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=20260721071358.E44411F000E9@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