Commit 1b72e7fd authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

cpufreq: schedutil: Use policy-dependent transition delays

Make the schedutil governor take the initial (default) value of the
rate_limit_us sysfs attribute from the (new) transition_delay_us
policy parameter (to be set by the scaling driver).

That will allow scaling drivers to make schedutil use smaller default
values of rate_limit_us and reduce the default average time interval
between consecutive frequency changes.

Make intel_pstate set transition_delay_us to 500.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 5ed8a1c1
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define INTEL_PSTATE_HWP_SAMPLING_INTERVAL (50 * NSEC_PER_MSEC) #define INTEL_PSTATE_HWP_SAMPLING_INTERVAL (50 * NSEC_PER_MSEC)
#define INTEL_CPUFREQ_TRANSITION_LATENCY 20000 #define INTEL_CPUFREQ_TRANSITION_LATENCY 20000
#define INTEL_CPUFREQ_TRANSITION_DELAY 500
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
#include <acpi/processor.h> #include <acpi/processor.h>
...@@ -2237,6 +2238,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -2237,6 +2238,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy)
return ret; return ret;
policy->cpuinfo.transition_latency = INTEL_CPUFREQ_TRANSITION_LATENCY; policy->cpuinfo.transition_latency = INTEL_CPUFREQ_TRANSITION_LATENCY;
policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY;
/* This reflects the intel_pstate_get_cpu_pstates() setting. */ /* This reflects the intel_pstate_get_cpu_pstates() setting. */
policy->cur = policy->cpuinfo.min_freq; policy->cur = policy->cpuinfo.min_freq;
......
...@@ -120,6 +120,13 @@ struct cpufreq_policy { ...@@ -120,6 +120,13 @@ struct cpufreq_policy {
bool fast_switch_possible; bool fast_switch_possible;
bool fast_switch_enabled; bool fast_switch_enabled;
/*
* Preferred average time interval between consecutive invocations of
* the driver to set the frequency for this policy. To be set by the
* scaling driver (0, which is the default, means no preference).
*/
unsigned int transition_delay_us;
/* Cached frequency lookup from cpufreq_driver_resolve_freq. */ /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
unsigned int cached_target_freq; unsigned int cached_target_freq;
int cached_resolved_idx; int cached_resolved_idx;
......
...@@ -494,7 +494,6 @@ static int sugov_init(struct cpufreq_policy *policy) ...@@ -494,7 +494,6 @@ static int sugov_init(struct cpufreq_policy *policy)
{ {
struct sugov_policy *sg_policy; struct sugov_policy *sg_policy;
struct sugov_tunables *tunables; struct sugov_tunables *tunables;
unsigned int lat;
int ret = 0; int ret = 0;
/* State should be equivalent to EXIT */ /* State should be equivalent to EXIT */
...@@ -533,10 +532,16 @@ static int sugov_init(struct cpufreq_policy *policy) ...@@ -533,10 +532,16 @@ static int sugov_init(struct cpufreq_policy *policy)
goto stop_kthread; goto stop_kthread;
} }
if (policy->transition_delay_us) {
tunables->rate_limit_us = policy->transition_delay_us;
} else {
unsigned int lat;
tunables->rate_limit_us = LATENCY_MULTIPLIER; tunables->rate_limit_us = LATENCY_MULTIPLIER;
lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC; lat = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
if (lat) if (lat)
tunables->rate_limit_us *= lat; tunables->rate_limit_us *= lat;
}
policy->governor_data = sg_policy; policy->governor_data = sg_policy;
sg_policy->tunables = tunables; sg_policy->tunables = tunables;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment