aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq_interactive.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index ada7da51b78..d42bbc2c3f2 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -42,8 +42,6 @@ struct cpufreq_interactive_cpuinfo {
42 int timer_idlecancel; 42 int timer_idlecancel;
43 u64 time_in_idle; 43 u64 time_in_idle;
44 u64 time_in_idle_timestamp; 44 u64 time_in_idle_timestamp;
45 u64 target_set_time;
46 u64 target_set_time_in_idle;
47 struct cpufreq_policy *policy; 45 struct cpufreq_policy *policy;
48 struct cpufreq_frequency_table *freq_table; 46 struct cpufreq_frequency_table *freq_table;
49 unsigned int target_freq; 47 unsigned int target_freq;
@@ -237,7 +235,6 @@ static void cpufreq_interactive_timer(unsigned long data)
237 unsigned int delta_idle; 235 unsigned int delta_idle;
238 unsigned int delta_time; 236 unsigned int delta_time;
239 int cpu_load; 237 int cpu_load;
240 int load_since_change;
241 struct cpufreq_interactive_cpuinfo *pcpu = 238 struct cpufreq_interactive_cpuinfo *pcpu =
242 &per_cpu(cpuinfo, data); 239 &per_cpu(cpuinfo, data);
243 u64 now_idle; 240 u64 now_idle;
@@ -265,23 +262,6 @@ static void cpufreq_interactive_timer(unsigned long data)
265 else 262 else
266 cpu_load = 100 * (delta_time - delta_idle) / delta_time; 263 cpu_load = 100 * (delta_time - delta_idle) / delta_time;
267 264
268 delta_idle = (unsigned int)(now_idle - pcpu->target_set_time_in_idle);
269 delta_time = (unsigned int)(now - pcpu->target_set_time);
270
271 if ((delta_time == 0) || (delta_idle > delta_time))
272 load_since_change = 0;
273 else
274 load_since_change =
275 100 * (delta_time - delta_idle) / delta_time;
276
277 /*
278 * Choose greater of short-term load (since last idle timer
279 * started or timer function re-armed itself) or long-term load
280 * (since last frequency change).
281 */
282 if (load_since_change > cpu_load)
283 cpu_load = load_since_change;
284
285 if ((cpu_load >= go_hispeed_load || boost_val) && 265 if ((cpu_load >= go_hispeed_load || boost_val) &&
286 pcpu->target_freq < hispeed_freq) 266 pcpu->target_freq < hispeed_freq)
287 new_freq = hispeed_freq; 267 new_freq = hispeed_freq;
@@ -334,8 +314,6 @@ static void cpufreq_interactive_timer(unsigned long data)
334 314
335 trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq, 315 trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
336 pcpu->policy->cur, new_freq); 316 pcpu->policy->cur, new_freq);
337 pcpu->target_set_time_in_idle = now_idle;
338 pcpu->target_set_time = now;
339 317
340 pcpu->target_freq = new_freq; 318 pcpu->target_freq = new_freq;
341 spin_lock_irqsave(&speedchange_cpumask_lock, flags); 319 spin_lock_irqsave(&speedchange_cpumask_lock, flags);
@@ -499,9 +477,8 @@ static void cpufreq_interactive_boost(void)
499 if (pcpu->target_freq < hispeed_freq) { 477 if (pcpu->target_freq < hispeed_freq) {
500 pcpu->target_freq = hispeed_freq; 478 pcpu->target_freq = hispeed_freq;
501 cpumask_set_cpu(i, &speedchange_cpumask); 479 cpumask_set_cpu(i, &speedchange_cpumask);
502 pcpu->target_set_time_in_idle = 480 pcpu->hispeed_validate_time =
503 get_cpu_idle_time_us(i, &pcpu->target_set_time); 481 ktime_to_us(ktime_get());
504 pcpu->hispeed_validate_time = pcpu->target_set_time;
505 anyboost = 1; 482 anyboost = 1;
506 } 483 }
507 484
@@ -814,14 +791,11 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
814 pcpu->policy = policy; 791 pcpu->policy = policy;
815 pcpu->target_freq = policy->cur; 792 pcpu->target_freq = policy->cur;
816 pcpu->freq_table = freq_table; 793 pcpu->freq_table = freq_table;
817 pcpu->target_set_time_in_idle =
818 get_cpu_idle_time_us(j,
819 &pcpu->target_set_time);
820 pcpu->floor_freq = pcpu->target_freq; 794 pcpu->floor_freq = pcpu->target_freq;
821 pcpu->floor_validate_time = 795 pcpu->floor_validate_time =
822 pcpu->target_set_time; 796 ktime_to_us(ktime_get());
823 pcpu->hispeed_validate_time = 797 pcpu->hispeed_validate_time =
824 pcpu->target_set_time; 798 pcpu->floor_validate_time;
825 pcpu->governor_enabled = 1; 799 pcpu->governor_enabled = 1;
826 smp_wmb(); 800 smp_wmb();
827 pcpu->cpu_timer.expires = 801 pcpu->cpu_timer.expires =