public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	juri.lelli@redhat.com, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, longman@redhat.com, hannes@cmpxchg.org,
	mkoutny@suse.com, void@manifault.com, arighi@nvidia.com,
	changwoo@igalia.com, cgroups@vger.kernel.org,
	sched-ext@lists.linux.dev, liuwenfang@honor.com,
	tglx@linutronix.de, Joel Fernandes <joelagnelf@nvidia.com>
Subject: Re: [RFC][PATCH 2/3] sched: Add support to pick functions to take rf
Date: Mon, 13 Oct 2025 13:04:49 +0200	[thread overview]
Message-ID: <20251013110449.GJ4067720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAKfTPtApJuw=Ad8aX=p3VLvMojyoxVBVRbMG80ADXR-NVL0PTw@mail.gmail.com>

On Thu, Oct 09, 2025 at 09:17:44AM +0200, Vincent Guittot wrote:
> On Wed, 8 Oct 2025 at 22:34, Tejun Heo <tj@kernel.org> wrote:
> >
> > Hello,
> >
> > On Wed, Oct 08, 2025 at 05:22:42PM +0200, Vincent Guittot wrote:
> > > On Wed, 8 Oct 2025 at 15:58, Peter Zijlstra <peterz@infradead.org> wrote:
> > > > On Wed, Oct 08, 2025 at 03:16:58PM +0200, Vincent Guittot wrote:
> > > >
> > > > > > +static struct task_struct *
> > > > > > +fair_server_pick_task(struct sched_dl_entity *dl_se, struct rq_flags *rf)
> > > > > >  {
> > > > > > -       return pick_next_task_fair(rq, prev, NULL);
> > > > >
> > > > > The special case of a NULL rf pointer is used to skip
> > > > > sched_balance_newidle() at the end of pick_next_task_fair() in the
> > > > > pick_next_task() slo path when prev_balance has already it. This means
> > > > > that it will be called twice if prev is not a fair task.
> > > >
> > > > Oh right. I suppose we can simply remove balance_fair.
> > >
> > > That was the option that I also had in mind but this will change from
> > > current behavior and I'm afraid that sched_ext people will complain.
> > > Currently, if prev is sched_ext, we don't call higher class.balance()
> > > which includes the fair class balance_fair->sched_balance_newidle.  If
> > > we now always call sched_balance_newidle() at the end
> > > pick_next_task_fair(), we will try to pull a fair task at each
> > > schedule between sched_ext tasks
> >
> > If we pass in @prev into pick(), can't pick() decide whether to newidle
> > balance or not based on that?
> 
> The problem is that with dl_server, you can has a prev of a lower prio
> but still want to run a newidle balance :
> -cfs task preempted by dl server
> -cfs task migrates to another cpu
> -we want to run newidle balance when cpu become idle

Bah; so yeah, this new behaviour is better for indeed always calling
newidle when it is needed, but you're also right that in case of ext
this might not be ideal.

So I have a pile of newidle hacks here:

  https://lkml.kernel.org/r/20251010170937.GG4067720@noisy.programming.kicks-ass.net

and while I don't particularly like NI_SPARE (the has_spare_tasks thing
is fickle); the idea seems to have some merit for this situation --
where we know we'll not be having fair tasks at all.

I mean, we can always do something like this to sched_balance_newidle():

	if (scx_switched_all())
		return 0;

Not pretty, but should do the job.

  reply	other threads:[~2025-10-13 11:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06 10:46 [RFC][PATCH 0/3] sched/ext: Cleanup pick_task_scx() Peter Zijlstra
2025-10-06 10:46 ` [RFC][PATCH 1/3] sched: Detect per-class runqueue changes Peter Zijlstra
2025-10-07 10:08   ` Juri Lelli
2025-10-07 10:16     ` Peter Zijlstra
2025-10-07 10:26       ` Juri Lelli
2025-10-16  9:33   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2025-10-06 10:46 ` [RFC][PATCH 2/3] sched: Add support to pick functions to take rf Peter Zijlstra
2025-10-08 13:16   ` Vincent Guittot
2025-10-08 13:58     ` Peter Zijlstra
2025-10-08 15:22       ` Vincent Guittot
2025-10-08 20:34         ` Tejun Heo
2025-10-09  7:17           ` Vincent Guittot
2025-10-13 11:04             ` Peter Zijlstra [this message]
2025-10-13 11:09               ` Peter Zijlstra
2025-10-13 13:06                 ` Vincent Guittot
2025-10-13 17:20                   ` Tejun Heo
2025-10-16  9:33   ` [tip: sched/core] " tip-bot2 for Joel Fernandes
2025-10-06 10:46 ` [RFC][PATCH 3/3] sched/ext: Fold balance_scx() into pick_task_scx() Peter Zijlstra
2025-10-16  9:33   ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2025-10-07 12:40 ` [RFC][PATCH 0/3] sched/ext: Cleanup pick_task_scx() Christian Loehle
2025-10-07 21:48 ` Tejun Heo
2025-10-08  9:11   ` Peter Zijlstra
2025-10-08 20:21     ` 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=20251013110449.GJ4067720@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=changwoo@igalia.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=joelagnelf@nvidia.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuwenfang@honor.com \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox