]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: intel_pstate: Remove max/min fractions to limit performance
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Mon, 12 Jun 2017 23:30:27 +0000 (16:30 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 23 Jun 2017 23:48:12 +0000 (01:48 +0200)
commit365b0a2265348782e2e739c4e98ca0f053eafe28
tree155752da5d5b41c954241d91470831920415902f
parent9fa909340cef38d99120f55adbb392bee3bc063c
cpufreq: intel_pstate: Remove max/min fractions to limit performance

In the current model the max/min perf limits are a fraction of current
user space limits to the allowed max_freq or 100% for global limits.
This results in wrong ratio limits calculation because of rounding
issues for some user space limits.

Initially we tried to solve this issue by issue by having more shift
bits to increase precision. Still there are isolated cases where we still
have error.

This can be avoided by using ratios all together. Since the way we get
cpuinfo.max_freq is by multiplying scaling factor to max ratio, we can
easily keep the max/min ratios in terms of ratios and not fractions.

For example:
if the max ratio = 36
cpuinfo.max_freq = 36 * 100000 = 3600000

Suppose user space sets a limit of 1200000, then we can calculate
max ratio limit as
= 36 * 1200000 / 3600000
= 12
This will be correct for any user limits.

The other advantage is that, we don't need to do any calculation in the
fast path as ratio limit is already calculated via set_policy() callback.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c