cpufreq: intel_pstate: Keep values in aperf/mperf in full precision
authorStratos Karafotis <stratosk@semaphore.gr>
Fri, 18 Jul 2014 15:37:25 +0000 (08:37 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Jul 2014 11:43:18 +0000 (13:43 +0200)
Currently we shift right aperf and mperf variables by FRAC_BITS
to prevent overflow when we convert them to fix point numbers
(shift left by FRAC_BITS).

But this is not necessary, because we actually use delta aperf and mperf
which are much less than APERF and MPERF values.

So, use the unmodified APERF and MPERF values in calculation.
This also adds 8 bits in precision, although the gain is insignificant.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c

index ff3c5624972c372c251a6864447fb82bfd570001..129ffb2853dcb7ba71fe8bab86ec81ac3cde2345 100644 (file)
@@ -584,9 +584,6 @@ static inline void intel_pstate_sample(struct cpudata *cpu)
        rdmsrl(MSR_IA32_MPERF, mperf);
        local_irq_restore(flags);
 
-       aperf = aperf >> FRAC_BITS;
-       mperf = mperf >> FRAC_BITS;
-
        cpu->last_sample_time = cpu->sample.time;
        cpu->sample.time = ktime_get();
        cpu->sample.aperf = aperf;