sched/walt: consolidate multiple rcu unlock statements

rcu unlock is being called in multiple places in walt_find_best_target().
Consolidate these calls.

Change-Id: I86701bc975fcc7d68b6faa95b952b9dd40c2f8a9
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Satya Durga Srinivasu Prabhala 2021-06-15 00:40:16 -07:00 committed by Rishabh Bhatnagar
parent ee77eeeb73
commit 32eccdc2bf

View File

@ -726,17 +726,14 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
/* Bail out if no candidate was found. */
weight = cpumask_weight(candidates);
if (!weight) {
rcu_read_unlock();
goto done;
}
if (!weight)
goto unlock;
max_cap_cpu = cpumask_first(candidates);
if (weight == 1) {
if (available_idle_cpu(max_cap_cpu) || max_cap_cpu == prev_cpu) {
best_energy_cpu = max_cap_cpu;
rcu_read_unlock();
goto done;
goto unlock;
}
}
@ -747,8 +744,7 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
if (!energy_eval_needed) {
best_energy_cpu = max_cap_cpu;
rcu_read_unlock();
goto done;
goto unlock;
}
if (p->state == TASK_WAKING)
@ -781,8 +777,6 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
}
}
rcu_read_unlock();
/*
* Pick the prev CPU, if best energy CPU can't saves at least 6% of
* the energy used by prev_cpu.
@ -794,6 +788,9 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
(capacity_orig_of(prev_cpu) <= capacity_orig_of(start_cpu)))
best_energy_cpu = prev_cpu;
unlock:
rcu_read_unlock();
done:
trace_sched_task_util(p, cpumask_bits(candidates)[0], best_energy_cpu,
sync, fbt_env.need_idle, fbt_env.fastpath,