diff --git a/kernel/sched/walt/walt_cfs.c b/kernel/sched/walt/walt_cfs.c index 7c10e3c2cb4a..5521856ac5d8 100644 --- a/kernel/sched/walt/walt_cfs.c +++ b/kernel/sched/walt/walt_cfs.c @@ -772,7 +772,7 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, cpumask_t *candidates; bool is_rtg, curr_is_rtg; struct find_best_target_env fbt_env; - bool need_idle = wake_to_idle(p) || uclamp_latency_sensitive(p); + bool need_idle = wake_to_idle(p); u64 start_t = 0; int delta = 0; int task_boost = per_task_boost(p); @@ -799,9 +799,6 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, is_rtg = task_in_related_thread_group(p); curr_is_rtg = task_in_related_thread_group(cpu_rq(cpu)->curr); - fbt_env.fastpath = 0; - fbt_env.need_idle = need_idle; - if (trace_sched_task_util_enabled()) start_t = sched_clock(); @@ -809,17 +806,22 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, candidates = this_cpu_ptr(&energy_cpus); cpumask_clear(candidates); + rcu_read_lock(); + need_idle |= uclamp_latency_sensitive(p); + + fbt_env.fastpath = 0; + fbt_env.need_idle = need_idle; + if (sync && (need_idle || (is_rtg && curr_is_rtg))) sync = 0; - if (sysctl_sched_sync_hint_enable && sync && - bias_to_this_cpu(p, cpu, start_cpu) && !cpu_halted(cpu)) { + if (sysctl_sched_sync_hint_enable && sync + && bias_to_this_cpu(p, cpu, start_cpu) && !cpu_halted(cpu)) { best_energy_cpu = cpu; fbt_env.fastpath = SYNC_WAKEUP; - goto done; + goto unlock; } - rcu_read_lock(); pd = rcu_dereference(rd->pd); if (!pd) goto fail; @@ -926,7 +928,6 @@ int walt_find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, unlock: rcu_read_unlock(); -done: if (best_energy_cpu < 0 || best_energy_cpu >= WALT_NR_CPUS) best_energy_cpu = prev_cpu;