Messages in this thread | | | Date | Tue, 28 Dec 2021 19:16:45 +0100 (CET) | From | Julia Lawall <> | Subject | Re: cpufreq: intel_pstate: map utilization into the pstate range |
| |
On Tue, 28 Dec 2021, Rafael J. Wysocki wrote:
> On Tue, Dec 28, 2021 at 6:46 PM Julia Lawall <julia.lawall@inria.fr> wrote: > > > > > > > > On Tue, 28 Dec 2021, Rafael J. Wysocki wrote: > > > > > On Tue, Dec 28, 2021 at 5:58 PM Julia Lawall <julia.lawall@inria.fr> wrote: > > > > > > > > I looked a bit more into why pstate 20 is always using the least energy. I > > > > have just one thread spinning for 10 seconds, I use a fixed value for the > > > > pstate, and I measure the energy usage with turbostat. > > > > > > How exactly do you fix the pstate? > > > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > > index e7af18857371..19440b15454c 100644 > > --- a/kernel/sched/cpufreq_schedutil.c > > +++ b/kernel/sched/cpufreq_schedutil.c > > @@ -400,7 +402,7 @@ static void sugov_update_single_perf(struct update_util_data *hook, u64 time, > > sg_cpu->util = prev_util; > > > > cpufreq_driver_adjust_perf(sg_cpu->cpu, map_util_perf(sg_cpu->bw_dl), > > - map_util_perf(sg_cpu->util), sg_cpu->max); > > + sysctl_sched_fixedfreq, sg_cpu->max); > > This is just changing the "target" hint given to the processor which > may very well ignore it, though.
It doesn't seem to ignore it. I also print the current frequency on every clock tick, and it is as it should be. This is done in the function arch_scale_freq_tick in arch/x86/kernel/smpboot.c, where I added:
trace_printk("freq %lld\n", div64_u64((cpu_khz * acnt), mcnt));
> > > > > sg_cpu->sg_policy->last_freq_update_time = time; > > } > > > > ------------------------------ > > > > sysctl_sched_fixedfreq is a variable that I added to sysfs. > > If I were trying to fix a pstate, I would set scaling_max_freq and > scaling_min_freq in sysfs for all CPUs to the same value. > > That would cause intel_pstate to set HWP min and max to the same value > which should really cause the pstate to be fixed, at least outside the > turbo range of pstates.
OK, I can try that, thanks.
julia
| |