Re: [PATCH] sched/topology: Disable sched_asym_cpucapacity on domain destruction

From: Quentin Perret
Date: Mon Oct 14 2019 - 09:53:04 EST


On Monday 14 Oct 2019 at 14:46:58 (+0100), Valentin Schneider wrote:
> (Replying to the reply because for some reason my mail client never got
> your reply?!)
>
> On 14/10/2019 14:29, Vincent Guittot wrote:
> > On Mon, 14 Oct 2019 at 14:16, Quentin Perret <qperret@xxxxxxxxxx> wrote:
> >> FWIW we already clear the EAS static key properly (based on the sd
> >> pointer, not the static key), so this is really only for the
> >> capacity-aware stuff.
> >>
>
> Ah, right.
>
> >> So what happens it you have mutiple root domains ? You might skip
> >> build_sched_domains() for one of them and end up not setting the static
> >> key when you should no ?
> >>
> >> I suppose an alternative would be to play with static_branch_inc() /
> >> static_branch_dec() from build_sched_domains() or something along those
> >> lines.
> >>
>
> Hmph, so I went with the concept that having the key set should mandate
> having a non-NULL sd_asym_cpucapacity domain, which is why I unset it as
> soon as one CPU gets attached to a NULL domain.
>
> Sadly as you pointed out, this doesn't work if we have another root domain
> that sees asymmetry. It also kinda sounds broken to have SDs of a root
> domain that does not see asymmetry (e.g. LITTLEs only) to see that key
> being set. Maybe what we want is to have a key per root domain?

Right, but that's not possible by definition -- static keys aren't
variables. The static keys for asym CPUs and for EAS are just to
optimize the case when they're disabled, but when they _are_ enabled,
you have no choice but do another per-rd check.

And to clarify what I tried to say before, it might be possible to
'count' the number of RDs that have SD_ASYM_CPUCAPACITY set using
static_branch_inc()/dec(), like we do for the SMT static key. I remember
trying to do something like that for EAS, but that was easier said than
done ... :)

Thanks,
Quentin