Re: [PATCH v2 1/2] x86,sched: Add support for frequency invariance

From: Peter Zijlstra
Date: Wed Oct 02 2019 - 14:28:20 EST


On Wed, Oct 02, 2019 at 02:29:25PM +0200, Giovanni Gherdovich wrote:
> +void x86_arch_scale_freq_tick_enable(void)
> +{
> + tick_disable = false;
> +}
> +
> +static void reset_scale_freq(void *arg)
> +{
> + this_cpu_write(arch_cpu_freq, SCHED_CAPACITY_SCALE);
> +}
> +
> +void x86_arch_scale_freq_tick_disable(void)
> +{
> + on_each_cpu(reset_scale_freq, NULL, 1);
> + tick_disable = true;

I'm thikning this ought to be the other way around, otherwise we can get
a tick loosing the 1024 we just wrote in arch_cpu_freq.

> +}

You've lost the prev_{a,m}perf update, so the first tick after enable
will see 'funny' values.