From e24b1df8d98f33ff236eba8ea1ea7c8990f622eb Mon Sep 17 00:00:00 2001 From: Biao Long Date: Thu, 19 Dec 2019 16:31:31 +0800 Subject: [PATCH] sched/fair: Don't place wakee on waker cpu if colocate enabled If both wakee and waker are in top-app,don't place wakee on waker cpu, because most of this case waker is not going to sleep,this will cause waker preempted and lead high runnable time,so let scheduler to select the best cpu in this case. Change-Id: If6eb3c0acb202197e9dd90205c581398ac049649 Signed-off-by: Biao Long --- kernel/sched/fair.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6947e28faea6..b612ad8fbeae 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7003,7 +7003,7 @@ int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, struct perf_domain *pd; unsigned long cur_energy; cpumask_t *candidates; - bool is_rtg; + bool is_rtg, curr_is_rtg; struct find_best_target_env fbt_env; bool need_idle = wake_to_idle(p); int placement_boost = task_boost_policy(p); @@ -7017,6 +7017,7 @@ int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, goto eas_not_ready; is_rtg = task_in_related_thread_group(p); + curr_is_rtg = task_in_related_thread_group(cpu_rq(cpu)->curr); fbt_env.fastpath = 0; @@ -7027,7 +7028,7 @@ int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, candidates = this_cpu_ptr(&energy_cpus); cpumask_clear(candidates); - if (need_idle) + if (sync && (need_idle || (is_rtg && curr_is_rtg))) sync = 0; if (sync && bias_to_this_cpu(p, cpu, start_cpu)) {