aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2013-02-06 07:34:00 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-08 19:18:47 -0500
commit4bd4e42819c7b5b2d608b353f4d9a7717e586479 (patch)
treee465d1cf94132d9c9c8e8e5501a1c2ded47d98ab
parentdf18e504aa5db8e7263c91e153c27c6f895da3c7 (diff)
cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold
In order to avoid the calculation of up_threshold - down_differential every time that the frequency must be decreased, we replace the down_differential tuner with the adj_up_threshold which keeps the difference across multiple checks. Update the adj_up_threshold only when the up_theshold is also updated. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq_governor.h2
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 16314b65ca67..d2ac91150600 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -109,7 +109,7 @@ struct od_dbs_tuners {
109 unsigned int sampling_rate; 109 unsigned int sampling_rate;
110 unsigned int sampling_down_factor; 110 unsigned int sampling_down_factor;
111 unsigned int up_threshold; 111 unsigned int up_threshold;
112 unsigned int down_differential; 112 unsigned int adj_up_threshold;
113 unsigned int powersave_bias; 113 unsigned int powersave_bias;
114 unsigned int io_is_busy; 114 unsigned int io_is_busy;
115}; 115};
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index f38b8da60128..09b27ae6576f 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -47,7 +47,8 @@ static struct cpufreq_governor cpufreq_gov_ondemand;
47static struct od_dbs_tuners od_tuners = { 47static struct od_dbs_tuners od_tuners = {
48 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, 48 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
49 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, 49 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,
50 .down_differential = DEF_FREQUENCY_DOWN_DIFFERENTIAL, 50 .adj_up_threshold = DEF_FREQUENCY_UP_THRESHOLD -
51 DEF_FREQUENCY_DOWN_DIFFERENTIAL,
51 .ignore_nice = 0, 52 .ignore_nice = 0,
52 .powersave_bias = 0, 53 .powersave_bias = 0,
53}; 54};
@@ -192,11 +193,9 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
192 * support the current CPU usage without triggering the up policy. To be 193 * support the current CPU usage without triggering the up policy. To be
193 * safe, we focus 10 points under the threshold. 194 * safe, we focus 10 points under the threshold.
194 */ 195 */
195 if (load_freq < (od_tuners.up_threshold - od_tuners.down_differential) * 196 if (load_freq < od_tuners.adj_up_threshold * policy->cur) {
196 policy->cur) {
197 unsigned int freq_next; 197 unsigned int freq_next;
198 freq_next = load_freq / (od_tuners.up_threshold - 198 freq_next = load_freq / od_tuners.adj_up_threshold;
199 od_tuners.down_differential);
200 199
201 /* No longer fully busy, reset rate_mult */ 200 /* No longer fully busy, reset rate_mult */
202 dbs_info->rate_mult = 1; 201 dbs_info->rate_mult = 1;
@@ -359,6 +358,10 @@ static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
359 input < MIN_FREQUENCY_UP_THRESHOLD) { 358 input < MIN_FREQUENCY_UP_THRESHOLD) {
360 return -EINVAL; 359 return -EINVAL;
361 } 360 }
361 /* Calculate the new adj_up_threshold */
362 od_tuners.adj_up_threshold += input;
363 od_tuners.adj_up_threshold -= od_tuners.up_threshold;
364
362 od_tuners.up_threshold = input; 365 od_tuners.up_threshold = input;
363 return count; 366 return count;
364} 367}
@@ -515,7 +518,8 @@ static int __init cpufreq_gov_dbs_init(void)
515 if (idle_time != -1ULL) { 518 if (idle_time != -1ULL) {
516 /* Idle micro accounting is supported. Use finer thresholds */ 519 /* Idle micro accounting is supported. Use finer thresholds */
517 od_tuners.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; 520 od_tuners.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
518 od_tuners.down_differential = MICRO_FREQUENCY_DOWN_DIFFERENTIAL; 521 od_tuners.adj_up_threshold = MICRO_FREQUENCY_UP_THRESHOLD -
522 MICRO_FREQUENCY_DOWN_DIFFERENTIAL;
519 /* 523 /*
520 * In nohz/micro accounting case we set the minimum frequency 524 * In nohz/micro accounting case we set the minimum frequency
521 * not depending on HZ, but fixed (very low). The deferred 525 * not depending on HZ, but fixed (very low). The deferred