From: Peter Zijlstra <peterz@infradead.org>
To: Barry Song <21cnbao@gmail.com>
Cc: Yicong Yang <yangyicong@hisilicon.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Tim Chen <tim.c.chen@linux.intel.com>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
LKML <linux-kernel@vger.kernel.org>,
LAK <linux-arm-kernel@lists.infradead.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
prime.zeng@huawei.com,
Jonathan Cameron <jonathan.cameron@huawei.com>,
ego@linux.vnet.ibm.com,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Linuxarm <linuxarm@huawei.com>,
Guodong Xu <guodong.xu@linaro.org>,
hesham.almatary@huawei.com, john.garry@huawei.com,
Yang Shen <shenyang39@huawei.com>,
kprateek.nayak@amd.com, Chen Yu <yu.c.chen@intel.com>,
wuyun.abel@bytedance.com
Subject: Re: [RESEND PATCH v5 2/2] sched/fair: Scan cluster before scanning LLC in wake-up path
Date: Thu, 21 Jul 2022 12:33:57 +0200 [thread overview]
Message-ID: <YtkrlVmqnx9VTbLl@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CAGsJ_4yrZnPbhBb4wd3x1h994tv6Jfri+y2xrPSJv7yF+Mj7tg@mail.gmail.com>
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@infradead.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.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Barry Song <21cnbao@gmail.com>
Cc: Yicong Yang <yangyicong@hisilicon.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Tim Chen <tim.c.chen@linux.intel.com>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
LKML <linux-kernel@vger.kernel.org>,
LAK <linux-arm-kernel@lists.infradead.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
prime.zeng@huawei.com,
Jonathan Cameron <jonathan.cameron@huawei.com>,
ego@linux.vnet.ibm.com,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
Linuxarm <linuxarm@huawei.com>,
Guodong Xu <guodong.xu@linaro.org>,
hesham.almatary@huawei.com, john.garry@huawei.com,
Yang Shen <shenyang39@huawei.com>,
kprateek.nayak@amd.com, Chen Yu <yu.c.chen@intel.com>,
wuyun.abel@bytedance.com
Subject: Re: [RESEND PATCH v5 2/2] sched/fair: Scan cluster before scanning LLC in wake-up path
Date: Thu, 21 Jul 2022 12:33:57 +0200 [thread overview]
Message-ID: <YtkrlVmqnx9VTbLl@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CAGsJ_4yrZnPbhBb4wd3x1h994tv6Jfri+y2xrPSJv7yF+Mj7tg@mail.gmail.com>
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@infradead.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.
next prev parent reply other threads:[~2022-07-21 10:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-20 8:11 [RESEND PATCH v5 0/2] sched/fair: Scan cluster before scanning LLC in wake-up path Yicong Yang
2022-07-20 8:11 ` Yicong Yang
2022-07-20 8:11 ` [RESEND PATCH v5 1/2] sched: Add per_cpu cluster domain info and cpus_share_lowest_cache API Yicong Yang
2022-07-20 8:11 ` Yicong Yang
2022-07-20 13:56 ` Vincent Guittot
2022-07-20 13:56 ` Vincent Guittot
2022-07-20 8:11 ` [RESEND PATCH v5 2/2] sched/fair: Scan cluster before scanning LLC in wake-up path Yicong Yang
2022-07-20 8:11 ` Yicong Yang
2022-07-20 11:14 ` Peter Zijlstra
2022-07-20 11:14 ` Peter Zijlstra
2022-07-20 11:33 ` Barry Song
2022-07-20 11:33 ` Barry Song
2022-07-21 9:38 ` Barry Song
2022-07-21 9:38 ` Barry Song
2022-07-21 10:33 ` Peter Zijlstra [this message]
2022-07-21 10:33 ` Peter Zijlstra
2022-07-21 12:42 ` Yicong Yang
2022-07-21 12:42 ` Yicong Yang
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=YtkrlVmqnx9VTbLl@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=21cnbao@gmail.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=gautham.shenoy@amd.com \
--cc=guodong.xu@linaro.org \
--cc=hesham.almatary@huawei.com \
--cc=john.garry@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mingo@redhat.com \
--cc=prime.zeng@huawei.com \
--cc=rostedt@goodmis.org \
--cc=shenyang39@huawei.com \
--cc=srikar@linux.vnet.ibm.com \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=wuyun.abel@bytedance.com \
--cc=yangyicong@hisilicon.com \
--cc=yu.c.chen@intel.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.