sched/walt: skip finding max when energy evaluating

Currently the code is finding the max_cap_cpu amongst candidates
but is unused if we are energy evaluating. Clean up the code.

Change-Id: I317ed8328851b69534c375c69387647a94ada659
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This commit is contained in:
Abhijeet Dharmapurikar 2021-07-28 12:54:27 -07:00 committed by Rishabh Bhatnagar
parent 58862813fa
commit 7bb38803c2

View File

@ -688,7 +688,7 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
int task_boost = per_task_boost(p);
bool uclamp_boost = walt_uclamp_boosted(p);
int start_cpu, order_index, end_index;
int max_cap_cpu = -1;
int first_cpu;
bool energy_eval_needed = true;
struct compute_energy_output output;
@ -747,25 +747,26 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu,
if (!weight)
goto unlock;
max_cap_cpu = cpumask_first(candidates);
first_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;
if (available_idle_cpu(first_cpu) || first_cpu == prev_cpu) {
best_energy_cpu = first_cpu;
goto unlock;
}
}
if (need_idle && available_idle_cpu(max_cap_cpu)) {
best_energy_cpu = max_cap_cpu;
if (need_idle && available_idle_cpu(first_cpu)) {
best_energy_cpu = first_cpu;
goto unlock;
}
for_each_cpu(cpu, candidates) {
if (capacity_orig_of(max_cap_cpu) < capacity_orig_of(cpu))
max_cap_cpu = cpu;
}
if (!energy_eval_needed) {
int max_cap_cpu = first_cpu;
for_each_cpu(cpu, candidates) {
if (capacity_orig_of(max_cap_cpu) < capacity_orig_of(cpu))
max_cap_cpu = cpu;
}
best_energy_cpu = max_cap_cpu;
goto unlock;
}