ANDROID: cpufreq: schedutil: maintain raw cache when next_f is not changed
Currently, the raw cache will be reset when next_f is changed after get_next_freq for correctness. However, it may introduce more cycles in those cases. This patch changes it to maintain the cached value instead of dropping it. Bug: 159936782 Bug: 158863204 Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I519ca02dd2e6038e3966e1f68fee641628827c82
This commit is contained in:
parent
272e21ccc9
commit
0fe3cf06ea
1 changed files with 7 additions and 4 deletions
|
|
@ -35,6 +35,7 @@ struct sugov_policy {
|
|||
s64 down_rate_delay_ns;
|
||||
unsigned int next_freq;
|
||||
unsigned int cached_raw_freq;
|
||||
unsigned int prev_cached_raw_freq;
|
||||
|
||||
/* The next fields are only needed if fast switch cannot be used: */
|
||||
struct irq_work irq_work;
|
||||
|
|
@ -134,8 +135,8 @@ static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
|
|||
return false;
|
||||
|
||||
if (sugov_up_down_rate_limit(sg_policy, time, next_freq)) {
|
||||
/* Reset cached freq as next_freq is not changed */
|
||||
sg_policy->cached_raw_freq = 0;
|
||||
/* Restore cached freq as next_freq is not changed */
|
||||
sg_policy->cached_raw_freq = sg_policy->prev_cached_raw_freq;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -213,6 +214,7 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
|
|||
return sg_policy->next_freq;
|
||||
|
||||
sg_policy->need_freq_update = false;
|
||||
sg_policy->prev_cached_raw_freq = sg_policy->cached_raw_freq;
|
||||
sg_policy->cached_raw_freq = freq;
|
||||
return cpufreq_driver_resolve_freq(policy, freq);
|
||||
}
|
||||
|
|
@ -520,8 +522,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
|
|||
if (busy && next_f < sg_policy->next_freq) {
|
||||
next_f = sg_policy->next_freq;
|
||||
|
||||
/* Reset cached freq as next_freq has changed */
|
||||
sg_policy->cached_raw_freq = 0;
|
||||
/* Restore cached freq as next_freq has changed */
|
||||
sg_policy->cached_raw_freq = sg_policy->prev_cached_raw_freq;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -929,6 +931,7 @@ static int sugov_start(struct cpufreq_policy *policy)
|
|||
sg_policy->limits_changed = false;
|
||||
sg_policy->need_freq_update = false;
|
||||
sg_policy->cached_raw_freq = 0;
|
||||
sg_policy->prev_cached_raw_freq = 0;
|
||||
|
||||
for_each_cpu(cpu, policy->cpus) {
|
||||
struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue