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>
This commit is contained in:
Junjie Wu 2014-08-29 18:55:45 -07:00 committed by David Keitel
parent 814503a967
commit 50d577eb97

View file

@ -127,6 +127,13 @@ struct cpufreq_interactive_tunables {
bool use_sched_load; bool use_sched_load;
bool use_migration_notif; 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 * Stay at max freq for at least max_freq_hysteresis before dropping
* frequency. * frequency.
@ -166,9 +173,16 @@ static u64 round_to_nw_start(u64 jif,
struct cpufreq_interactive_tunables *tunables) struct cpufreq_interactive_tunables *tunables)
{ {
unsigned long step = usecs_to_jiffies(tunables->timer_rate); unsigned long step = usecs_to_jiffies(tunables->timer_rate);
u64 ret;
do_div(jif, step); if (tunables->use_sched_load || tunables->align_windows) {
return (jif + 1) * step; 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( static inline int set_window_helper(
@ -946,6 +960,7 @@ static ssize_t store_##file_name( \
return count; \ return count; \
} }
show_store_one(max_freq_hysteresis); show_store_one(max_freq_hysteresis);
show_store_one(align_windows);
static ssize_t show_go_hispeed_load(struct cpufreq_interactive_tunables static ssize_t show_go_hispeed_load(struct cpufreq_interactive_tunables
*tunables, char *buf) *tunables, char *buf)
@ -1328,6 +1343,7 @@ show_store_gov_pol_sys(io_is_busy);
show_store_gov_pol_sys(use_sched_load); show_store_gov_pol_sys(use_sched_load);
show_store_gov_pol_sys(use_migration_notif); show_store_gov_pol_sys(use_migration_notif);
show_store_gov_pol_sys(max_freq_hysteresis); show_store_gov_pol_sys(max_freq_hysteresis);
show_store_gov_pol_sys(align_windows);
#define gov_sys_attr_rw(_name) \ #define gov_sys_attr_rw(_name) \
static struct global_attr _name##_gov_sys = \ static struct global_attr _name##_gov_sys = \
@ -1354,6 +1370,7 @@ gov_sys_pol_attr_rw(io_is_busy);
gov_sys_pol_attr_rw(use_sched_load); gov_sys_pol_attr_rw(use_sched_load);
gov_sys_pol_attr_rw(use_migration_notif); gov_sys_pol_attr_rw(use_migration_notif);
gov_sys_pol_attr_rw(max_freq_hysteresis); gov_sys_pol_attr_rw(max_freq_hysteresis);
gov_sys_pol_attr_rw(align_windows);
static struct global_attr boostpulse_gov_sys = static struct global_attr boostpulse_gov_sys =
__ATTR(boostpulse, 0200, NULL, store_boostpulse_gov_sys); __ATTR(boostpulse, 0200, NULL, store_boostpulse_gov_sys);
@ -1377,6 +1394,7 @@ static struct attribute *interactive_attributes_gov_sys[] = {
&use_sched_load_gov_sys.attr, &use_sched_load_gov_sys.attr,
&use_migration_notif_gov_sys.attr, &use_migration_notif_gov_sys.attr,
&max_freq_hysteresis_gov_sys.attr, &max_freq_hysteresis_gov_sys.attr,
&align_windows_gov_sys.attr,
NULL, NULL,
}; };
@ -1401,6 +1419,7 @@ static struct attribute *interactive_attributes_gov_pol[] = {
&use_sched_load_gov_pol.attr, &use_sched_load_gov_pol.attr,
&use_migration_notif_gov_pol.attr, &use_migration_notif_gov_pol.attr,
&max_freq_hysteresis_gov_pol.attr, &max_freq_hysteresis_gov_pol.attr,
&align_windows_gov_pol.attr,
NULL, NULL,
}; };
@ -1468,6 +1487,7 @@ static struct cpufreq_interactive_tunables *alloc_tunable(
tunables->timer_rate = DEFAULT_TIMER_RATE; tunables->timer_rate = DEFAULT_TIMER_RATE;
tunables->boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME; tunables->boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME;
tunables->timer_slack_val = DEFAULT_TIMER_SLACK; tunables->timer_slack_val = DEFAULT_TIMER_SLACK;
tunables->align_windows = true;
spin_lock_init(&tunables->target_loads_lock); spin_lock_init(&tunables->target_loads_lock);
spin_lock_init(&tunables->above_hispeed_delay_lock); spin_lock_init(&tunables->above_hispeed_delay_lock);