From 32eccdc2bfe2b1626e6d4a9dacb0db1f500d6bdb Mon Sep 17 00:00:00 2001 From: Satya Durga Srinivasu Prabhala Date: Tue, 15 Jun 2021 00:40:16 -0700 Subject: [PATCH] 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 --- kernel/sched/walt/walt_cfs.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 1e65919138a7..2a06a0c3c19b 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -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,