Re: [PATCH v5 2/3] sched/topology: Rework CPU capacity asymmetry detection

From: Beata Michalska
Date: Thu Jun 03 2021 - 05:24:24 EST


On Thu, Jun 03, 2021 at 11:09:48AM +0200, Dietmar Eggemann wrote:
> On 02/06/2021 21:48, Beata Michalska wrote:
> > On Wed, Jun 02, 2021 at 07:17:12PM +0200, Dietmar Eggemann wrote:
> >> On 27/05/2021 19:07, Beata Michalska wrote:
> >>> On Thu, May 27, 2021 at 05:08:42PM +0200, Dietmar Eggemann wrote:
> >>>> On 26/05/2021 23:40, Beata Michalska wrote:
> >>>>> On Wed, May 26, 2021 at 08:17:41PM +0200, Dietmar Eggemann wrote:
> >>>>>> On 26/05/2021 14:51, Beata Michalska wrote:
> >>>>>>> On Wed, May 26, 2021 at 01:15:46PM +0100, Beata Michalska wrote:
> >>>>>>>> On Wed, May 26, 2021 at 11:52:25AM +0200, Dietmar Eggemann wrote:
> >>>>>>>>> On 25/05/2021 12:29, Beata Michalska wrote:
> >>>>>>>>>> On Tue, May 25, 2021 at 10:53:07AM +0100, Valentin Schneider wrote:
> >>>>>>>>>>> On 24/05/21 23:55, Beata Michalska wrote:
> >>>>>>>>>>>> On Mon, May 24, 2021 at 07:01:04PM +0100, Valentin Schneider wrote:
> >>>>>>>>>>>>> On 24/05/21 11:16, Beata Michalska wrote:
>
> [...]
>
> > So what I have done is :
> >
> > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> > index 77e6f79235ad..ec4ae225687e 100644
> > --- a/kernel/sched/topology.c
> > +++ b/kernel/sched/topology.c
> > @@ -1324,6 +1324,7 @@ asym_cpu_capacity_classify(struct sched_domain *sd,
> > if (!asym_cap_miss)
> > sd_asym_flags |= SD_ASYM_CPUCAPACITY_FULL;
> >
> > + WARN_ONCE(cpu_smt_flags() & sd->flags, "Detected CPU capacity asymmetry on SMT level");
> > leave:
> > return sd_asym_flags;
> > }
> >
> > Comment can be adjusted.
> > This would sit in the classify function to nicely wrap asymmetry bits in one
> > place. What do you think ?
>
> ... and you would need to pass in the sched domain pointer ;-)
Yes, as that was for current version.
>
> Still prefer to check it in sd_init() since there is where we set the flags.
>
> But you can't do 'cpu_smt_flags() & sd->flags'. MC level would hit too,
> since it has SD_SHARE_PKG_RESOURCES as well.
Yeah, I would need to check:
cpu_smt_flags() & sd->flags == cpu_smt_flags()
and if I am to move it to sd_init then additionally checking for
SD_ASYM_CPUCAPACITY ... and #ifdef for SMT .....
so I guess I will go with your proposal using the SD_SHARE_CPUCAPACITY directly.
Will update in the v7.

---
BR
B.