[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtkrlVmqnx9VTbLl@worktop.programming.kicks-ass.net>
Date: Thu, 21 Jul 2022 12:33:57 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Barry Song <21cnbao@...il.com>
Cc: Yicong Yang <yangyicong@...ilicon.com>,
Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
LKML <linux-kernel@...r.kernel.org>,
LAK <linux-arm-kernel@...ts.infradead.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
prime.zeng@...wei.com,
Jonathan Cameron <jonathan.cameron@...wei.com>,
ego@...ux.vnet.ibm.com,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Linuxarm <linuxarm@...wei.com>,
Guodong Xu <guodong.xu@...aro.org>, hesham.almatary@...wei.com,
john.garry@...wei.com, Yang Shen <shenyang39@...wei.com>,
kprateek.nayak@....com, Chen Yu <yu.c.chen@...el.com>,
wuyun.abel@...edance.com
Subject: Re: [RESEND PATCH v5 2/2] sched/fair: Scan cluster before scanning
LLC in wake-up path
On Thu, Jul 21, 2022 at 09:38:04PM +1200, Barry Song wrote:
> On Wed, Jul 20, 2022 at 11:15 PM Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > On Wed, Jul 20, 2022 at 04:11:50PM +0800, Yicong Yang wrote:
> > > + /* TODO: Support SMT system with cluster topology */
> > > + if (!sched_smt_active() && sd) {
> > > + for_each_cpu_and(cpu, cpus, sched_domain_span(sd)) {
> >
> > So that's no SMT and no wrap iteration..
> >
> > Does something like this work?
> >
> > ---
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -6437,6 +6437,30 @@ static int select_idle_cpu(struct task_s
> > }
> > }
> >
> > + if (IS_ENABLED(CONFIG_SCHED_CLUSTER) &&
> > + static_branch_unlikely(&sched_cluster_active)) {
> > + struct sched_domain *sdc = rcu_dereference(per_cpu(sd_cluster, target));
> > + if (sdc) {
> > + for_each_cpu_wrap(cpu, sched_domain_span(sdc), target + 1) {
> > + if (!cpumask_test_cpu(cpu, cpus))
> > + continue;
> > +
> > + if (has_idle_core) {
> > + i = select_idle_core(p, cpu, cpus, &idle_cpu);
> > + if ((unsigned int)i < nr_cpumask_bits)
> > + return i;
> > + } else {
> > + if (--nr <= 0)
> > + return -1;
> > + idle_cpu = __select_idle_cpu(cpu, p);
> > + if ((unsigned int)idle_cpu < nr_cpumask_bits)
> > + break;
>
> Guess here it should be "return idle_cpu", but not "break". as "break"
> will make us scan more
> other cpus outside the cluster if we have found idle_cpu within the cluster.
>
> Yicong,
> Please test Peter's code with the above change.
Indeed. Sorry for that.
Powered by blists - more mailing lists