Commit 2d045036 authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

cpufreq: governor: Drop min_sampling_rate

The cpufreq core and governors aren't supposed to set a limit on how
fast we want to try changing the frequency. This is currently done for
the legacy governors with help of min_sampling_rate.

At worst, we may end up setting the sampling rate to a value lower than
the rate at which frequency can be changed and then one of the CPUs in
the policy will be only changing frequency for ever.

But that is something for the user to decide and there is no need to
have special handling for such cases in the core. Leave it for the user
to figure out.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 9dbd224f
...@@ -471,14 +471,6 @@ This governor exposes the following tunables: ...@@ -471,14 +471,6 @@ This governor exposes the following tunables:
# echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate # echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate
``min_sampling_rate``
The minimum value of ``sampling_rate``.
Equal to 10000 (10 ms) if :c:macro:`CONFIG_NO_HZ_COMMON` and
:c:data:`tick_nohz_active` are both set or to 20 times the value of
:c:data:`jiffies` in microseconds otherwise.
``up_threshold`` ``up_threshold``
If the estimated CPU load is above this value (in percent), the governor If the estimated CPU load is above this value (in percent), the governor
will set the frequency to the maximum value allowed for the policy. will set the frequency to the maximum value allowed for the policy.
......
...@@ -246,7 +246,6 @@ gov_show_one_common(sampling_rate); ...@@ -246,7 +246,6 @@ gov_show_one_common(sampling_rate);
gov_show_one_common(sampling_down_factor); gov_show_one_common(sampling_down_factor);
gov_show_one_common(up_threshold); gov_show_one_common(up_threshold);
gov_show_one_common(ignore_nice_load); gov_show_one_common(ignore_nice_load);
gov_show_one_common(min_sampling_rate);
gov_show_one(cs, down_threshold); gov_show_one(cs, down_threshold);
gov_show_one(cs, freq_step); gov_show_one(cs, freq_step);
...@@ -254,12 +253,10 @@ gov_attr_rw(sampling_rate); ...@@ -254,12 +253,10 @@ gov_attr_rw(sampling_rate);
gov_attr_rw(sampling_down_factor); gov_attr_rw(sampling_down_factor);
gov_attr_rw(up_threshold); gov_attr_rw(up_threshold);
gov_attr_rw(ignore_nice_load); gov_attr_rw(ignore_nice_load);
gov_attr_ro(min_sampling_rate);
gov_attr_rw(down_threshold); gov_attr_rw(down_threshold);
gov_attr_rw(freq_step); gov_attr_rw(freq_step);
static struct attribute *cs_attributes[] = { static struct attribute *cs_attributes[] = {
&min_sampling_rate.attr,
&sampling_rate.attr, &sampling_rate.attr,
&sampling_down_factor.attr, &sampling_down_factor.attr,
&up_threshold.attr, &up_threshold.attr,
...@@ -297,10 +294,7 @@ static int cs_init(struct dbs_data *dbs_data) ...@@ -297,10 +294,7 @@ static int cs_init(struct dbs_data *dbs_data)
dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD;
dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
dbs_data->ignore_nice_load = 0; dbs_data->ignore_nice_load = 0;
dbs_data->tuners = tuners; dbs_data->tuners = tuners;
dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO *
jiffies_to_usecs(10);
return 0; return 0;
} }
......
...@@ -47,14 +47,11 @@ ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf, ...@@ -47,14 +47,11 @@ ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf,
{ {
struct dbs_data *dbs_data = to_dbs_data(attr_set); struct dbs_data *dbs_data = to_dbs_data(attr_set);
struct policy_dbs_info *policy_dbs; struct policy_dbs_info *policy_dbs;
unsigned int rate;
int ret; int ret;
ret = sscanf(buf, "%u", &rate); ret = sscanf(buf, "%u", &dbs_data->sampling_rate);
if (ret != 1) if (ret != 1)
return -EINVAL; return -EINVAL;
dbs_data->sampling_rate = max(rate, dbs_data->min_sampling_rate);
/* /*
* We are operating under dbs_data->mutex and so the list and its * We are operating under dbs_data->mutex and so the list and its
* entries can't be freed concurrently. * entries can't be freed concurrently.
...@@ -437,10 +434,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) ...@@ -437,10 +434,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
latency = 1; latency = 1;
/* Bring kernel and HW constraints together */ /* Bring kernel and HW constraints together */
dbs_data->min_sampling_rate = max(dbs_data->min_sampling_rate, dbs_data->sampling_rate = LATENCY_MULTIPLIER * latency;
MIN_LATENCY_MULTIPLIER * latency);
dbs_data->sampling_rate = max(dbs_data->min_sampling_rate,
LATENCY_MULTIPLIER * latency);
if (!have_governor_per_policy()) if (!have_governor_per_policy())
gov->gdbs_data = dbs_data; gov->gdbs_data = dbs_data;
......
...@@ -41,7 +41,6 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE}; ...@@ -41,7 +41,6 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE};
struct dbs_data { struct dbs_data {
struct gov_attr_set attr_set; struct gov_attr_set attr_set;
void *tuners; void *tuners;
unsigned int min_sampling_rate;
unsigned int ignore_nice_load; unsigned int ignore_nice_load;
unsigned int sampling_rate; unsigned int sampling_rate;
unsigned int sampling_down_factor; unsigned int sampling_down_factor;
......
...@@ -319,7 +319,6 @@ gov_show_one_common(sampling_rate); ...@@ -319,7 +319,6 @@ gov_show_one_common(sampling_rate);
gov_show_one_common(up_threshold); gov_show_one_common(up_threshold);
gov_show_one_common(sampling_down_factor); gov_show_one_common(sampling_down_factor);
gov_show_one_common(ignore_nice_load); gov_show_one_common(ignore_nice_load);
gov_show_one_common(min_sampling_rate);
gov_show_one_common(io_is_busy); gov_show_one_common(io_is_busy);
gov_show_one(od, powersave_bias); gov_show_one(od, powersave_bias);
...@@ -329,10 +328,8 @@ gov_attr_rw(up_threshold); ...@@ -329,10 +328,8 @@ gov_attr_rw(up_threshold);
gov_attr_rw(sampling_down_factor); gov_attr_rw(sampling_down_factor);
gov_attr_rw(ignore_nice_load); gov_attr_rw(ignore_nice_load);
gov_attr_rw(powersave_bias); gov_attr_rw(powersave_bias);
gov_attr_ro(min_sampling_rate);
static struct attribute *od_attributes[] = { static struct attribute *od_attributes[] = {
&min_sampling_rate.attr,
&sampling_rate.attr, &sampling_rate.attr,
&up_threshold.attr, &up_threshold.attr,
&sampling_down_factor.attr, &sampling_down_factor.attr,
...@@ -373,17 +370,8 @@ static int od_init(struct dbs_data *dbs_data) ...@@ -373,17 +370,8 @@ static int od_init(struct dbs_data *dbs_data)
if (idle_time != -1ULL) { if (idle_time != -1ULL) {
/* Idle micro accounting is supported. Use finer thresholds */ /* Idle micro accounting is supported. Use finer thresholds */
dbs_data->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; dbs_data->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
/*
* In nohz/micro accounting case we set the minimum frequency
* not depending on HZ, but fixed (very low).
*/
dbs_data->min_sampling_rate = MICRO_FREQUENCY_MIN_SAMPLE_RATE;
} else { } else {
dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD;
/* For correct statistics, we need 10 ticks for each measure */
dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO *
jiffies_to_usecs(10);
} }
dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
......
...@@ -491,9 +491,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, ...@@ -491,9 +491,7 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div,
* For CPUs with transition latency > 10ms (mostly drivers with CPUFREQ_ETERNAL) * For CPUs with transition latency > 10ms (mostly drivers with CPUFREQ_ETERNAL)
* the ondemand governor will not work. All times here are in us (microseconds). * the ondemand governor will not work. All times here are in us (microseconds).
*/ */
#define MIN_SAMPLING_RATE_RATIO (2)
#define LATENCY_MULTIPLIER (1000) #define LATENCY_MULTIPLIER (1000)
#define MIN_LATENCY_MULTIPLIER (20)
#define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000) #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000)
struct cpufreq_governor { struct cpufreq_governor {
......
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