summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2016-11-21 16:33:19 -0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-11-22 02:31:48 +0100
commit46992d6b55b558ac4128c1f846de3cfddfa7cf7c (patch)
treeb9aac54db57286dab66268478fa652212f41374d /drivers/cpufreq
parent30248feff5e5c6a01ade5e6126009e296ed8bd35 (diff)
downloadlinux-46992d6b55b558ac4128c1f846de3cfddfa7cf7c.tar.bz2
cpufreq: intel_pstate: round up min_perf limits
In some use cases, user wants to enforce a minimum performance limit on CPUs. But because of simple division the resultant performance is 100 MHz less than the desired in some cases. For example when the maximum frequency is 3.50 GHz, setting scaling_min_frequency to 1.6 GHz always results in 1.5 GHz minimum. With simple round up, the frequency can be set to 1.6 GHz to minimum in this case. This round up is already done to max_policy_pct and max_perf, so do the same for min_policy_pct and min_perf. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 0d82bf320838..e5ef51d7be4e 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1583,8 +1583,8 @@ static void intel_pstate_update_perf_limits(struct cpufreq_policy *policy,
if (policy->max == policy->min) {
limits->min_policy_pct = limits->max_policy_pct;
} else {
- limits->min_policy_pct = (policy->min * 100) /
- policy->cpuinfo.max_freq;
+ limits->min_policy_pct = DIV_ROUND_UP(policy->min * 100,
+ policy->cpuinfo.max_freq);
limits->min_policy_pct = clamp_t(int, limits->min_policy_pct,
0, 100);
}
@@ -1605,6 +1605,7 @@ static void intel_pstate_update_perf_limits(struct cpufreq_policy *policy,
limits->min_perf = div_fp(limits->min_perf_pct, 100);
limits->max_perf = div_fp(limits->max_perf_pct, 100);
limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
+ limits->min_perf = round_up(limits->min_perf, FRAC_BITS);
mutex_unlock(&intel_pstate_limits_lock);