Skip to content

Commit

Permalink
cpufreq: intel_pstate: Keep values in aperf/mperf in full precision
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Dirk Brandewie <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
Stratos Karafotis authored and rafaeljw committed Jul 21, 2014
1 parent 4ab60c3 commit ac65813
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ac65813

Please sign in to comment.