Sched_ext development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tejun Heo" <tj@kernel.org>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 2/2] sched_ext: Fix the bypass dispatch claim for schedulers bypassed by an ancestor
Date: Sun, 11 Oct 2026 21:47:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-167465@kernel.org> (raw)
In-Reply-To: <20261011214028.743546-3-tj@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] sched_ext: Mixing goto-based cleanup and guard() in scx_bypass()
--

commit c63689b3855e65ddcc5c7f3211328556c68f2c61
Author: Tejun Heo <tj@kernel.org>

sched_ext: Fix the bypass dispatch claim for schedulers bypassed by an ancestor

This commit fixes a bypass dispatch claim leak when a sub-scheduler's depth
goes from zero to one under an ancestor. It ensures claims are properly
propagated to descendants and released when the depth returns to zero.

Cc: stable@vger.kernel.org # v7.1+

> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 7df47c6741009..630afee30c0c5 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c

[ ... ]

> @@ -6197,8 +6197,12 @@ void scx_bypass(struct scx_sched *sch, bool bypass)
>  	}
>  
>  	/* disarming must come after moving all tasks out of the bypass DSQs */
> -	if (!bypass)
> -		scx_disable_bypass_dsp(sch);
> +	if (!bypass) {
> +		guard(raw_spinlock)(&scx_sched_lock);
> +		scx_for_each_descendant_pre(pos, sch)
> +			if (!pos->bypass_depth)
> +				scx_disable_bypass_dsp(pos);
> +	}
>  unlock:
>  	raw_spin_unlock_irqrestore(&scx_bypass_lock, flags);
>  }

[Severity: Low]
Does this introduce a mix of scope-based cleanup and goto-based cleanup
in scx_bypass()?

According to the cleanup subsystem guidelines (include/linux/cleanup.h),
mixing goto-based cleanup labels with guard() declarations in the same
function creates confusing ownership semantics and is explicitly prohibited.
Developers are expected to convert all resources in the function to
scope-based cleanup, or convert none of them.

This patch introduces guard(raw_spinlock)(&scx_sched_lock) while retaining
the unlock: label and goto-based cleanup that releases scx_bypass_lock.
This mixing increases the risk of future LIFO ordering mistakes or
use-after-free bugs during refactoring.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011214028.743546-1-tj@kernel.org?part=2

  reply	other threads:[~2026-10-11 21:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-11 21:40 [PATCHSET sched_ext/for-7.3-fixes] sched_ext: Fix bypass propagation and the bypass dispatch claim for overlapping bypasses Tejun Heo
2026-10-11 21:40 ` [PATCH 1/2] sched_ext: Propagate every bypass depth change to the descendants Tejun Heo
2026-10-11 21:40 ` [PATCH 2/2] sched_ext: Fix the bypass dispatch claim for schedulers bypassed by an ancestor Tejun Heo
2026-10-11 21:47   ` sashiko-bot [this message]
2026-10-12 18:11 ` [PATCHSET sched_ext/for-7.3-fixes] sched_ext: Fix bypass propagation and the bypass dispatch claim for overlapping bypasses Andrea Righi
2026-10-12 18:40 ` 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=sashiko-outbox-167465@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