cpufreq: interactive: Make window alignment optional
Make sampling window alignment optional when scheduler inputs
are not enabled.
Change-Id: If69c111a3efe219cdd1e38c1f46f03404789c0bb
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index 638fef4..47716c9 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -128,6 +128,13 @@
bool use_migration_notif;
/*
+ * Whether to align timer windows across all CPUs. When
+ * use_sched_load is true, this flag is ignored and windows
+ * will always be aligned.
+ */
+ bool align_windows;
+
+ /*
* Stay at max freq for at least max_freq_hysteresis before dropping
* frequency.
*/
@@ -166,9 +173,16 @@
struct cpufreq_interactive_tunables *tunables)
{
unsigned long step = usecs_to_jiffies(tunables->timer_rate);
+ u64 ret;
- do_div(jif, step);
- return (jif + 1) * step;
+ if (tunables->use_sched_load || tunables->align_windows) {
+ do_div(jif, step);
+ ret = (jif + 1) * step;
+ } else {
+ ret = jiffies + usecs_to_jiffies(tunables->timer_rate);
+ }
+
+ return ret;
}
static inline int set_window_helper(
@@ -946,6 +960,7 @@
return count; \
}
show_store_one(max_freq_hysteresis);
+show_store_one(align_windows);
static ssize_t show_go_hispeed_load(struct cpufreq_interactive_tunables
*tunables, char *buf)
@@ -1328,6 +1343,7 @@
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);
#define gov_sys_attr_rw(_name) \
static struct global_attr _name##_gov_sys = \
@@ -1354,6 +1370,7 @@
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);
static struct global_attr boostpulse_gov_sys =
__ATTR(boostpulse, 0200, NULL, store_boostpulse_gov_sys);
@@ -1377,6 +1394,7 @@
&use_sched_load_gov_sys.attr,
&use_migration_notif_gov_sys.attr,
&max_freq_hysteresis_gov_sys.attr,
+ &align_windows_gov_sys.attr,
NULL,
};
@@ -1401,6 +1419,7 @@
&use_sched_load_gov_pol.attr,
&use_migration_notif_gov_pol.attr,
&max_freq_hysteresis_gov_pol.attr,
+ &align_windows_gov_pol.attr,
NULL,
};
@@ -1466,6 +1485,7 @@
tunables->timer_rate = DEFAULT_TIMER_RATE;
tunables->boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME;
tunables->timer_slack_val = DEFAULT_TIMER_SLACK;
+ tunables->align_windows = true;
spin_lock_init(&tunables->target_loads_lock);
spin_lock_init(&tunables->above_hispeed_delay_lock);