From 7a9df46bbbc7caf07d9becc1c98b96efb7608ccf Mon Sep 17 00:00:00 2001 From: Junjie Wu Date: Wed, 25 Mar 2015 14:05:49 -0700 Subject: [PATCH] cpufreq: interactive: Ramp up directly if cpu_load exceeds 100 When governor is using regular busy time tracking, cpu_load will never exceed 100 because busy time will never exceed elapsed time in any one sampling window. The only exception is when frequency is reduced in middle of a window (e.g. due to thermal throttling). In this case, cpu_load is likely irrelevant since current frequency governor has been voting is already higher than what target can run at. However, on a heterogeneous CPU system with scheduler input enabled to track the load of migrated tasks, cpu_load could also exceed 100 when a task migrates from more capable CPU to slower CPU. When this happens, governor already knows the exact frequency required to handle this load. There is no need to progressively ramp up frequency in order to assess the load's real demand. It's not desirable to starve such a migrating task by forcing it through ramping up process on the slower CPU. Direclty jump beyond hispeed_freq and ignore above_hispeed_delay if cpu_load exceeds 100. Change-Id: Ib87057e4f00732fad943ab595a33e3059494ef15 Signed-off-by: Junjie Wu --- drivers/cpufreq/cpufreq_interactive.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 69fd67b253c..c5ce6c7f053 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -394,6 +394,7 @@ static u64 update_load(int cpu) return now; } +#define MAX_LOCAL_LOAD 100 static void cpufreq_interactive_timer(unsigned long data) { u64 now; @@ -431,7 +432,8 @@ static void cpufreq_interactive_timer(unsigned long data) boosted = tunables->boost_val || now < tunables->boostpulse_endtime; if (cpu_load >= tunables->go_hispeed_load || boosted) { - if (pcpu->target_freq < tunables->hispeed_freq) { + if (pcpu->target_freq < tunables->hispeed_freq&& + cpu_load <= MAX_LOCAL_LOAD) { new_freq = tunables->hispeed_freq; } else { new_freq = choose_freq(pcpu, loadadjfreq); @@ -446,7 +448,8 @@ static void cpufreq_interactive_timer(unsigned long data) new_freq = tunables->hispeed_freq; } - if (pcpu->target_freq >= tunables->hispeed_freq && + if (cpu_load <= MAX_LOCAL_LOAD && + pcpu->target_freq >= tunables->hispeed_freq && new_freq > pcpu->target_freq && now - pcpu->hispeed_validate_time < freq_to_above_hispeed_delay(tunables, pcpu->target_freq)) { -- 2.20.1