[PATCH 09/70] cpufreq: interactive: Separate speed target revalidate time and initial set time

From: BÃlint Czobor
Date: Tue Oct 27 2015 - 13:31:55 EST


From: Todd Poynor <toddpoynor@xxxxxxxxxx>

Allow speed drop after min_sample_time elapses from last time
the current speed was last re-validated as appropriate for
current load / input boost.

Allow speed bump after min_sample_time (or above_hispeed_delay)
elapses from the time the current speed was originally set.

Change-Id: Ic25687a7a53d25e6544c30c47d7ab6f27a47bee8
Signed-off-by: Todd Poynor <toddpoynor@xxxxxxxxxx>
Signed-off-by: BÃlint Czobor <czoborbalint@xxxxxxxxx>
---
drivers/cpufreq/cpufreq_interactive.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index b78174f..083f790 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -46,6 +46,8 @@ struct cpufreq_interactive_cpuinfo {
int idling;
u64 target_set_time;
u64 target_set_time_in_idle;
+ u64 target_validate_time;
+ u64 target_validate_time_in_idle;
struct cpufreq_policy *policy;
struct cpufreq_frequency_table *freq_table;
unsigned int target_freq;
@@ -208,10 +210,10 @@ static void cpufreq_interactive_timer(unsigned long data)

/*
* Do not scale down unless we have been at this frequency for the
- * minimum sample time.
+ * minimum sample time since last validated.
*/
if (new_freq < pcpu->target_freq) {
- if (pcpu->timer_run_time - pcpu->target_set_time
+ if (pcpu->timer_run_time - pcpu->target_validate_time
< min_sample_time) {
trace_cpufreq_interactive_notyet(data, cpu_load,
pcpu->target_freq, new_freq);
@@ -219,8 +221,8 @@ static void cpufreq_interactive_timer(unsigned long data)
}
}

- pcpu->target_set_time_in_idle = now_idle;
- pcpu->target_set_time = pcpu->timer_run_time;
+ pcpu->target_validate_time_in_idle = now_idle;
+ pcpu->target_validate_time = pcpu->timer_run_time;

if (pcpu->target_freq == new_freq) {
trace_cpufreq_interactive_already(data, cpu_load,
@@ -230,6 +232,8 @@ static void cpufreq_interactive_timer(unsigned long data)

trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
new_freq);
+ pcpu->target_set_time_in_idle = now_idle;
+ pcpu->target_set_time = pcpu->timer_run_time;

if (new_freq < pcpu->target_freq) {
pcpu->target_freq = new_freq;
@@ -614,6 +618,10 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
pcpu->target_set_time_in_idle =
get_cpu_idle_time_us(j,
&pcpu->target_set_time);
+ pcpu->target_validate_time =
+ pcpu->target_set_time;
+ pcpu->target_validate_time_in_idle =
+ pcpu->target_set_time_in_idle;
pcpu->governor_enabled = 1;
smp_wmb();
}
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/