[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251013110449.GJ4067720@noisy.programming.kicks-ass.net>
Date: Mon, 13 Oct 2025 13:04:49 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
mingo@...nel.org, juri.lelli@...hat.com, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, longman@...hat.com, hannes@...xchg.org,
mkoutny@...e.com, void@...ifault.com, arighi@...dia.com,
changwoo@...lia.com, cgroups@...r.kernel.org,
sched-ext@...ts.linux.dev, liuwenfang@...or.com, tglx@...utronix.de,
Joel Fernandes <joelagnelf@...dia.com>
Subject: Re: [RFC][PATCH 2/3] sched: Add support to pick functions to take rf
On Thu, Oct 09, 2025 at 09:17:44AM +0200, Vincent Guittot wrote:
> On Wed, 8 Oct 2025 at 22:34, Tejun Heo <tj@...nel.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@...radead.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.
Powered by blists - more mailing lists