Sched_ext development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kuba Piecuch" <jpiecuch@google.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [RFC PATCH 1/2] sched_ext: Reenqueue IMMED tasks when a higher class wins the pick
Date: Wed, 25 Nov 2026 12:16:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-233340@kernel.org> (raw)
In-Reply-To: <20261125114932.3198836-2-jpiecuch@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched_ext: missed scx_settle_pick() on core-sched sibling in
  pick_next_task()
--

commit 6268089dba82c4845b6bc4c92ec88a503f333074
Author: Kuba Piecuch <jpiecuch@google.com>

sched_ext: Reenqueue IMMED tasks when a higher class wins the pick

This commit adds scx_settle_pick() in __schedule() after task selection and
proxy resolution complete so that SCX_ENQ_IMMED tasks on the local DSQ are
reenqueued whenever rq->next_class ends up above ext_sched_class, replacing
the proxy-only check in scx_proxy_reenqueue_retry().

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index ea89471d4743c..430795ddd2c55 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7389,6 +7389,7 @@ static void __sched notrace __schedule(int sched_mode)
>  	clear_tsk_need_resched(prev);
>  	clear_preempt_need_resched();
>  keep_resched:
> +	scx_settle_pick(rq);
>  	rq->last_seen_need_resched_ns = 0;
>  
>  	is_switch = prev != next;

[Severity: Medium]
With CONFIG_SCHED_CORE, can a sibling CPU miss scx_settle_pick() and leave
SCX_ENQ_IMMED tasks stranded on its local DSQ when cookie matching falls
back to its currently running higher-class task?

During a core-wide pick in pick_next_task(), pick_task(rq_i, rf) on a
sibling running a higher-class task with core_cookie C can run
ext_server_pick_task() -> do_pick_task_scx().  That lowers rq_i->next_class
to &ext_sched_class via rq_modified_begin() and allows ops.dispatch() to
insert an SCX_ENQ_IMMED task with a different cookie onto
rq_i->scx.local_dsq.  If another sibling's task with cookie C wins max and
sched_core_find(rq_i, C) selects rq_i->curr again, pick_next_task() skips
rescheduling rq_i:

kernel/sched/core.c:pick_next_task() {
	...
		if (rq_i->curr == rq_i->core_pick) {
			rq_i->core_pick = NULL;
			rq_i->core_dl_server = NULL;
			continue;
		}

		resched_curr(rq_i);
	...
}

Because rq_i never enters __schedule(), rq_i->next_class is not restored to
rq_i->curr->sched_class and scx_settle_pick(rq_i) never runs, leaving the
IMMED task on rq_i->scx.local_dsq while the higher-class task continues
running and causing subsequent rq_is_open(rq_i, ...) checks to see
rq_i->next_class == &ext_sched_class.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125114932.3198836-2-jpiecuch@google.com?part=1

  reply	other threads:[~2026-11-25 12:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 11:50 [RFC PATCHSET sched_ext/for-7.4-fixes] sched_ext: Reenqueue IMMED tasks when a higher class wins the pick Kuba Piecuch
2026-11-25 11:50 ` [RFC PATCH 1/2] " Kuba Piecuch
2026-11-25 12:16   ` sashiko-bot [this message]
2026-11-27 15:10   ` Tejun Heo
2026-11-25 11:50 ` [RFC PATCH 2/2] selftests/sched_ext: Add immed_strand test Kuba Piecuch

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-233340@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jpiecuch@google.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