From: Chen Yu <yu.c.chen@intel.com>
To: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Mike Galbraith <efault@gmx.de>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>,
Tim Chen <tim.c.chen@intel.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Abel Wu <wuyun.abel@bytedance.com>,
Yicong Yang <yangyicong@hisilicon.com>,
"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
Len Brown <len.brown@intel.com>, Chen Yu <yu.chen.surf@gmail.com>,
Arjan Van De Ven <arjan.van.de.ven@intel.com>,
Aaron Lu <aaron.lu@intel.com>, Barry Song <baohua@kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] sched/fair: Introduce SIS_PAIR to wakeup task on local idle core first
Date: Thu, 18 May 2023 12:17:01 +0800 [thread overview]
Message-ID: <ZGWmveL2YTiXp2XR@chenyu5-mobl1> (raw)
In-Reply-To: <0ac968e3-cd80-6339-970d-37005876b145@amd.com>
Hi Prateek,
On 2023-05-18 at 09:00:38 +0530, K Prateek Nayak wrote:
> Hello Chenyu,
>
> I'll do some light testing with some benchmarks and share results on the
> thread but meanwhile I have a few observations with the implementation.
>
Thanks for reviewing this change.
> On 5/17/2023 10:27 PM, Chen Yu wrote:
> > On 2023-05-16 at 13:51:26 +0200, Mike Galbraith wrote:
> >> On Tue, 2023-05-16 at 16:41 +0800, Chen Yu wrote:
> >> [..snip..]
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 7d2613ab392c..572d663065e3 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -7126,6 +7126,23 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
> > asym_fits_cpu(task_util, util_min, util_max, target))
> > return target;
> >
> > + /*
> > + * If the waker and the wakee are good friends to each other,
> > + * putting them within the same SMT domain could reduce C2C
> > + * overhead. But this only applies when there is no idle core
> > + * available. SMT idle sibling should be prefered to wakee's
> > + * previous CPU, because the latter could still have the risk of C2C
> > + * overhead.
> > + *
> > + */
> > + if (sched_feat(SIS_PAIR) && sched_smt_active() && !has_idle_core &&
>
> "has_idle_core" is not populated at this point and will always be false
> from the initialization. Should there be a:
>
> has_idle_core = test_idle_cores(? /* Which CPU? */);
Yes you are right, I have 2 patches, the first one is to check has_idle_core
in the beginning but I forgot to send it out but only the second one.
> if (sched_feat(SIS_PAIR) ...) {
> ...
> }
> has_idle_core = false;
>
> ?: "has_idle_core" is currently used in select_idle_sibling() from the
> perspective of the target MC. Does switching target to current core
> (which may not be on the same MC) if target MC does not have an idle core
> make sense in all scenarios?
Right, we should check whether target equals to current CPU. Since I tested
with 1 socket online, this issue did not expose
>
> > + current->last_wakee == p && p->last_wakee == current) {
> > + i = select_idle_smt(p, smp_processor_id());
>
> Also wondering if asym_fits_cpu() check is needed in some way here.
> Consider a case where waker is on a weaker capacity CPU but wakee
> previously ran on a stronger capacity CPU. It might be worthwhile
> to wake the wakee on previous CPU if the current CPU does not fit
> the task's utilization and move the pair to the CPU with larger
> capacity during the next wakeup. wake_affine_weight() would select
> a target based on load and capacity consideration but here we
> switch the wakeup target to a thread on the current core.
>
> Wondering if the capacity details already considered in the path?
>
Good point, I guess what you mean is that, target could be other CPU rather than
the current one, there should be a check if the target equals to current CPU.
Let me refine the patch and have a test.
thanks,
Chenyu
> > +
> > + if ((unsigned int)i < nr_cpumask_bits)
> > + return i;
> > + }
> > +
> > /*
> > * If the previous CPU is cache affine and idle, don't be stupid:
> > */
> > diff --git a/kernel/sched/features.h b/kernel/sched/features.h
> > index ee7f23c76bd3..86b5c4f16199 100644
> > --- a/kernel/sched/features.h
> > +++ b/kernel/sched/features.h
> > @@ -62,6 +62,7 @@ SCHED_FEAT(TTWU_QUEUE, true)
> > */
> > SCHED_FEAT(SIS_PROP, false)
> > SCHED_FEAT(SIS_UTIL, true)
> > +SCHED_FEAT(SIS_PAIR, true)
> >
> > /*
> > * Issue a WARN when we do multiple update_rq_clock() calls
>
> --
> Thanks and Regards,
> Prateek
next prev parent reply other threads:[~2023-05-18 4:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 1:11 [RFC PATCH] sched/fair: Introduce SIS_PAIR to wakeup task on local idle core first Chen Yu
2023-05-16 6:23 ` Mike Galbraith
2023-05-16 8:41 ` Chen Yu
2023-05-16 11:51 ` Mike Galbraith
2023-05-17 16:57 ` Chen Yu
2023-05-17 19:52 ` Mike Galbraith
2023-05-18 3:41 ` Chen Yu
2023-05-19 11:15 ` Mike Galbraith
2023-05-18 3:30 ` K Prateek Nayak
2023-05-18 4:17 ` Chen Yu [this message]
2023-05-18 10:26 ` K Prateek Nayak
2023-05-22 4:10 ` Chen Yu
2023-05-22 7:10 ` Mike Galbraith
2023-05-25 7:47 ` Chen Yu
2023-05-25 9:33 ` Mike Galbraith
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=ZGWmveL2YTiXp2XR@chenyu5-mobl1 \
--to=yu.c.chen@intel.com \
--cc=aaron.lu@intel.com \
--cc=arjan.van.de.ven@intel.com \
--cc=baohua@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=efault@gmx.de \
--cc=gautham.shenoy@amd.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@intel.com \
--cc=vincent.guittot@linaro.org \
--cc=wuyun.abel@bytedance.com \
--cc=yangyicong@hisilicon.com \
--cc=yu.chen.surf@gmail.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.