From fdbf09dfc11cd2259765ccc75f7052021c07889c Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Tue, 26 Mar 2019 15:26:25 +0800 Subject: [PATCH] sched/fair: refine some scheduler changes from AU drop Refine some changes from AU90. One is to allow boosted task run on min capacity cpu if it fits in. The other is to check fast exit for prefer-idle task first. Bug: 128477368 Bug: 130576120 Test: task rq selection behavior is as expected Change-Id: Ied57b37a361ed137d10167f0346f52a149d08cd6 Signed-off-by: Rick Yiu Signed-off-by: Alexander Winkowski --- kernel/sched/fair.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7777ea6a6b9b..68bbb5f0e6f0 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7372,8 +7372,7 @@ static inline bool task_fits_max(struct task_struct *p, int cpu) if (is_min_capacity_cpu(cpu)) { if (task_boost_policy(p) == SCHED_BOOST_ON_BIG || - task_boost > 0 || - schedtune_task_boost(p) > 0) + task_boost > 0) return false; } else { /* mid cap cpu */ if (task_boost > 1) @@ -7891,6 +7890,14 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, } while (sg = sg->next, sg != sd->groups); + if (prefer_idle && (best_idle_cpu != -1)) { + trace_sched_find_best_target(p, prefer_idle, min_util, cpu, + best_idle_cpu, best_active_cpu, + -1, best_idle_cpu, -1); + + return best_idle_cpu; + } + if (best_idle_cpu != -1 && !is_packing_eligible(p, target_cpu, fbt_env, active_cpus_count, best_idle_cstate, boosted)) { @@ -7919,14 +7926,6 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, * b) IDLE CPU: best_idle_cpu */ - if (prefer_idle && (best_idle_cpu != -1)) { - trace_sched_find_best_target(p, prefer_idle, min_util, cpu, - best_idle_cpu, best_active_cpu, - -1, best_idle_cpu, -1); - - return best_idle_cpu; - } - if (target_cpu == -1) target_cpu = prefer_idle ? best_active_cpu