From 50d577eb97ab582697db1bdb937bcfab99dea9ea Mon Sep 17 00:00:00 2001 From: Junjie Wu Date: Fri, 29 Aug 2014 18:55:45 -0700 Subject: [PATCH] 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 --- drivers/cpufreq/cpufreq_interactive.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 2e07f438e6e3..7755586455d6 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -127,6 +127,13 @@ struct cpufreq_interactive_tunables { bool use_sched_load; 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 @@ static u64 round_to_nw_start(u64 jif, 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 @@ static ssize_t store_##file_name( \ 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(io_is_busy); 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(io_is_busy); 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 @@ static struct attribute *interactive_attributes_gov_sys[] = { &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 @@ static struct attribute *interactive_attributes_gov_pol[] = { &use_sched_load_gov_pol.attr, &use_migration_notif_gov_pol.attr, &max_freq_hysteresis_gov_pol.attr, + &align_windows_gov_pol.attr, NULL, }; @@ -1468,6 +1487,7 @@ static struct cpufreq_interactive_tunables *alloc_tunable( 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);