aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2014-07-18 11:37:27 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-21 07:43:19 -0400
commit78e2708691e9289f97750eb71aca31b5a2973d94 (patch)
tree62857f16ff381de7fcf982a7b4d8c1bd69834f8c /drivers/cpufreq
parent4b707c893d0937be9c7be437950a312fbaf47601 (diff)
cpufreq: intel_pstate: Remove core_pct rounding
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>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/intel_pstate.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2ff85f665f93..c5eac949760d 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -545,13 +545,9 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu)
545{ 545{
546 struct sample *sample = &cpu->sample; 546 struct sample *sample = &cpu->sample;
547 int64_t core_pct; 547 int64_t core_pct;
548 int32_t rem;
549 548
550 core_pct = int_tofp(sample->aperf) * int_tofp(100); 549 core_pct = int_tofp(sample->aperf) * int_tofp(100);
551 core_pct = div_u64_rem(core_pct, int_tofp(sample->mperf), &rem); 550 core_pct = div64_u64(core_pct, int_tofp(sample->mperf));
552
553 if ((rem << 1) >= int_tofp(sample->mperf))
554 core_pct += 1;
555 551
556 sample->freq = fp_toint( 552 sample->freq = fp_toint(
557 mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); 553 mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct));