From 5e3baefe8ef7fe0cdf3a83c7ff7fe67863726a90 Mon Sep 17 00:00:00 2001 From: Junjie Wu Date: Wed, 22 Jul 2015 17:38:49 -0700 Subject: cpufreq: interactive: Make skipping delay for migration optional Commit 92352c0a65bc ("cpufreq: interactive: Ramp up directly if cpu_load exceeds 100") and commit 594945e67031 ("cpufreq: interactive: Skip delay in frequency changes due to migration") allow interactive governor to skip above_hispeed_delay and min_sample_time if the frequency evaluation request comes from scheduler. Power and performance benefits of these two features are dependent on the behavior of each workload. Adverse load pattern may experience regression instead of improvement. Make both features optional by introducing a sysfs file for each. Both features are disabled by default. Change-Id: I394c7fac00e6b20259dd198bd526a32ead54f14e Signed-off-by: Junjie Wu --- drivers/cpufreq/cpufreq_interactive.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 7a262974b128..c18c20d5fe54 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -145,6 +145,10 @@ struct cpufreq_interactive_tunables { * frequency. */ unsigned int max_freq_hysteresis; + + /* Whether to change frequency immediately for notification */ + bool fast_ramp_up; + bool fast_ramp_down; }; /* @@ -509,7 +513,7 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif) if (cpu_load >= tunables->go_hispeed_load || tunables->boosted) { if (ppol->policy->cur < tunables->hispeed_freq && - cpu_load <= MAX_LOCAL_LOAD) { + (!tunables->fast_ramp_up || cpu_load <= MAX_LOCAL_LOAD)) { new_freq = tunables->hispeed_freq; } else { new_freq = choose_freq(ppol, loadadjfreq); @@ -524,7 +528,7 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif) new_freq = tunables->hispeed_freq; } - if (cpu_load <= MAX_LOCAL_LOAD && + if ((!tunables->fast_ramp_up || cpu_load <= MAX_LOCAL_LOAD) && ppol->policy->cur >= tunables->hispeed_freq && new_freq > ppol->policy->cur && now - ppol->hispeed_validate_time < @@ -547,7 +551,8 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif) new_freq = ppol->freq_table[index].frequency; - if (!is_notif && new_freq < ppol->target_freq && + if ((!tunables->fast_ramp_down || !is_notif) && + new_freq < ppol->target_freq && now - ppol->max_freq_hyst_start_time < tunables->max_freq_hysteresis) { trace_cpufreq_interactive_notyet(max_cpu, cpu_load, @@ -560,7 +565,8 @@ static void __cpufreq_interactive_timer(unsigned long data, bool is_notif) * Do not scale below floor_freq unless we have been at or above the * floor frequency for the minimum sample time since last validated. */ - if (!is_notif && new_freq < ppol->floor_freq) { + if ((!tunables->fast_ramp_down || !is_notif) && + new_freq < ppol->floor_freq) { if (now - ppol->floor_validate_time < tunables->min_sample_time) { trace_cpufreq_interactive_notyet( @@ -952,6 +958,8 @@ static ssize_t store_##file_name( \ } show_store_one(max_freq_hysteresis); show_store_one(align_windows); +show_store_one(fast_ramp_up); +show_store_one(fast_ramp_down); static ssize_t show_go_hispeed_load(struct cpufreq_interactive_tunables *tunables, char *buf) @@ -1344,6 +1352,8 @@ show_store_gov_pol_sys(use_sched_load); show_store_gov_pol_sys(use_migration_notif); show_store_gov_pol_sys(max_freq_hysteresis); show_store_gov_pol_sys(align_windows); +show_store_gov_pol_sys(fast_ramp_up); +show_store_gov_pol_sys(fast_ramp_down); #define gov_sys_attr_rw(_name) \ static struct global_attr _name##_gov_sys = \ @@ -1371,6 +1381,8 @@ gov_sys_pol_attr_rw(use_sched_load); gov_sys_pol_attr_rw(use_migration_notif); gov_sys_pol_attr_rw(max_freq_hysteresis); gov_sys_pol_attr_rw(align_windows); +gov_sys_pol_attr_rw(fast_ramp_up); +gov_sys_pol_attr_rw(fast_ramp_down); static struct global_attr boostpulse_gov_sys = __ATTR(boostpulse, 0200, NULL, store_boostpulse_gov_sys); @@ -1395,6 +1407,8 @@ static struct attribute *interactive_attributes_gov_sys[] = { &use_migration_notif_gov_sys.attr, &max_freq_hysteresis_gov_sys.attr, &align_windows_gov_sys.attr, + &fast_ramp_up_gov_sys.attr, + &fast_ramp_down_gov_sys.attr, NULL, }; @@ -1420,6 +1434,8 @@ static struct attribute *interactive_attributes_gov_pol[] = { &use_migration_notif_gov_pol.attr, &max_freq_hysteresis_gov_pol.attr, &align_windows_gov_pol.attr, + &fast_ramp_up_gov_pol.attr, + &fast_ramp_down_gov_pol.attr, NULL, }; -- cgit v1.2.3