mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: cpufreq: Fix store_powersave_bias to account for sync' CPUs.
Current code assumes that all online CPUs runs their own timers to collect CPU samples for demand based switching (dbs). But in case of synchronous CPUs, ondemand governor registers only one timer at init time because both CPUs are accounted in the same timer call. Hence trying to restart/cancel dbs timers for all online CPUs is not legal for these CPUs. This change fixes above function to restart/cancel timers only once for group of synchronous CPUs. Change-Id: I23f1697783a65f125679a07a076620e8fa5e62d5 Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
This commit is contained in:
parent
85d448090a
commit
8676f36913
1 changed files with 31 additions and 1 deletions
|
@ -469,9 +469,12 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
|
|||
{
|
||||
int input = 0;
|
||||
int bypass = 0;
|
||||
int ret, cpu, reenable_timer;
|
||||
int ret, cpu, reenable_timer, j;
|
||||
struct cpu_dbs_info_s *dbs_info;
|
||||
|
||||
struct cpumask cpus_timer_done;
|
||||
cpumask_clear(&cpus_timer_done);
|
||||
|
||||
ret = sscanf(buf, "%d", &input);
|
||||
|
||||
if (ret != 1)
|
||||
|
@ -504,10 +507,23 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
|
|||
continue;
|
||||
|
||||
dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
|
||||
|
||||
for_each_cpu(j, &cpus_timer_done) {
|
||||
if (!dbs_info->cur_policy) {
|
||||
pr_err("Dbs policy is NULL\n");
|
||||
goto skip_this_cpu;
|
||||
}
|
||||
if (cpumask_test_cpu(j, dbs_info->
|
||||
cur_policy->cpus))
|
||||
goto skip_this_cpu;
|
||||
}
|
||||
|
||||
cpumask_set_cpu(cpu, &cpus_timer_done);
|
||||
if (dbs_info->cur_policy) {
|
||||
/* restart dbs timer */
|
||||
dbs_timer_init(dbs_info);
|
||||
}
|
||||
skip_this_cpu:
|
||||
unlock_policy_rwsem_write(cpu);
|
||||
}
|
||||
}
|
||||
|
@ -520,6 +536,19 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
|
|||
continue;
|
||||
|
||||
dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
|
||||
|
||||
for_each_cpu(j, &cpus_timer_done) {
|
||||
if (!dbs_info->cur_policy) {
|
||||
pr_err("Dbs policy is NULL\n");
|
||||
goto skip_this_cpu_bypass;
|
||||
}
|
||||
if (cpumask_test_cpu(j, dbs_info->
|
||||
cur_policy->cpus))
|
||||
goto skip_this_cpu_bypass;
|
||||
}
|
||||
|
||||
cpumask_set_cpu(cpu, &cpus_timer_done);
|
||||
|
||||
if (dbs_info->cur_policy) {
|
||||
/* cpu using ondemand, cancel dbs timer */
|
||||
mutex_lock(&dbs_info->timer_mutex);
|
||||
|
@ -532,6 +561,7 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
|
|||
|
||||
mutex_unlock(&dbs_info->timer_mutex);
|
||||
}
|
||||
skip_this_cpu_bypass:
|
||||
unlock_policy_rwsem_write(cpu);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue