On Tue, Sep 17, 2019 at 04:27:46PM +0200, Giovanni Gherdovich wrote: > Hello Quentin, > > On Sat, 2019-09-14 at 12:57 +0200, Quentin Perret wrote: > > Hi Giovanni > > > > On Monday 09 Sep 2019 at 04:42:15 (+0200), Giovanni Gherdovich wrote: > > > +static inline long arch_scale_freq_capacity(int cpu) > > > +{ > > > + if (static_cpu_has(X86_FEATURE_APERFMPERF)) > > > + return per_cpu(arch_cpu_freq, cpu); > > > > So, if this is conditional, perhaps you could also add this check in an > > x86-specific implementation of arch_scale_freq_invariant() ? That would > > guide sugov in the right path (see get_next_freq()) if APERF/MPERF are > > unavailable. > > > > > + return 1024 /* SCHED_CAPACITY_SCALE */; > > > +} > > > > Good remark. If the cpu doesn't have APERF/MPERF, the choice here is that > freq_curr is constantly equal to freq_max, and the scaling factor is 1 all the > time. > > But I'm checking this static_cpu_has() every time I do a frequency update; > arguably schedutil should be smarter and settle such a case once and for all > at boot time. > > I'll check what's the cost of static_cpu_has() and if it's non-negligible I'll > do what you suggest (x86-specific version of arch_scale_freq_invariant().
static_cpu_has() is an alternative and ends up being a static branch (similar to static_key) once the alternative patching runs.