]> git.karo-electronics.de Git - linux-beck.git/commitdiff
cpufreq: intel_pstate: Remove core_pct rounding
authorStratos Karafotis <stratosk@semaphore.gr>
Fri, 18 Jul 2014 15:37:27 +0000 (08:37 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Jul 2014 11:43:19 +0000 (13:43 +0200)
The specific rounding adds conditionally only 1/256 to fractional
part of core_pct.

We can safely remove it without any noticeable impact in
calculations.

Use div64_u64 instead of div_u64 to avoid possible overflow of
sample->mperf as divisor

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 2ff85f665f93925563e7dd30cc819d393c31170d..c5eac949760de99ab8345fa1933657278afe7092 100644 (file)
@@ -545,13 +545,9 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu)
 {
        struct sample *sample = &cpu->sample;
        int64_t core_pct;
-       int32_t rem;
 
        core_pct = int_tofp(sample->aperf) * int_tofp(100);
-       core_pct = div_u64_rem(core_pct, int_tofp(sample->mperf), &rem);
-
-       if ((rem << 1) >= int_tofp(sample->mperf))
-               core_pct += 1;
+       core_pct = div64_u64(core_pct, int_tofp(sample->mperf));
 
        sample->freq = fp_toint(
                mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct));