All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-7.3-fixes] sched_ext: Don't report a forced-idle CPU as open for IMMED tasks
Date: Sat, 17 Oct 2026 23:30:51 +0200	[thread overview]
Message-ID: <atPpCyLMK3rnvNqF@gpd4> (raw)
In-Reply-To: <49d76a6ae49b2e0d5359edc831ffaf60@kernel.org>

Hi Tejun,

On Sat, Oct 17, 2026 at 10:36:19AM -1000, Tejun Heo wrote:
> Hello, Andrea.
> 
> On Sat, Oct 17, 2026 at 02:47:49PM +0200, Andrea Righi wrote:
> > +static bool higher_class_runnable(struct rq *rq)
> > +{
> > +	if (sched_stop_runnable(rq))
> > +		return true;
> > +
> > +	/* The ext server selects SCX tasks ahead of RT and fair tasks. */
> > +	if (sched_dl_runnable(rq))
> > +		return rb_first_cached(&rq->dl.root) != &rq->ext_server.rb_node;
> > +
> > +	return sched_rt_runnable(rq) || sched_fair_runnable(rq);
> > +}
> 
> This duplicates the core pick order in sched_ext, the dl_server ordering
> included, which is brittle. It also misses the case where the IMMED
> task's own cookie forces the CPU idle, e.g. a tagged IMMED task while
> the sibling runs an untagged RT task, as nothing above ext is runnable
> on the CPU itself.

Ah, right, a tagged IMMED task inserted on a CPU whose sibling runs an
untagged SCHED_FIFO task stays parked on the local DSQ with this patch
applied, which is wrong.

> 
> Instead of predicting the pick, how about reacting to it? A CPU picking
> idle with IMMED tasks on its local DSQ means that they didn't run
> immediately, whatever the reason. scx_update_idle() is already called on
> every idle pick, from set_next_task_idle() on a task to idle switch and
> from pick_task_idle() on an idle to idle re-pick, so maybe something
> like the following in __scx_update_idle()?
> 
> 	if (idle && unlikely(rq->scx.nr_immed))
> 		scx_schedule_reenq_local(rq, SCX_REENQ_...);
> 
> Outside forced idle, nr_immed should be zero there as pick_task_scx()
> would have taken the local DSQ head. The reenq would need a flag telling
> reenq_local() to skip rq_is_open(), as next_class is idle and the rq
> would look open, keeping the IMMED task at the head.

Yeah, makes sense and it looks like a much more robust approach. I'll
send a new version that drops higher_class_runnable() and does this,
with an internal SCX_REENQ_IDLE_PICK (?) flag to make reenq_local() skip
rq_is_open().

Thanks for taking a look at this!

-Andrea

      reply	other threads:[~2026-10-17 21:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17 12:47 [PATCH sched_ext/for-7.3-fixes] sched_ext: Don't report a forced-idle CPU as open for IMMED tasks Andrea Righi
2026-10-17 20:36 ` Tejun Heo
2026-10-17 21:30   ` Andrea Righi [this message]

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=atPpCyLMK3rnvNqF@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.