From 59651c62212e9666e6217131b01d8c21bcd031f1 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Tue, 30 Jun 2020 14:43:33 +0800 Subject: [PATCH] sched/fair: schedule lower priority tasks from little cores With scheduler placement hint, there still could be several boosted tasks contending for big cores. On chipset with fewer big cores, it might cause problems like jank. To improve it, schedule tasks of prio >= DEFAULT_PRIO from little cores if they could fit, even for tasks that prefer high capacity cpus, since such prio means they are less important. Bug: 158936596 Test: tasks scheduled as expected Signed-off-by: Rick Yiu Change-Id: Ic0cc06461818944e3e97ec0493c0d9c9f1a5e217 [backported to 4.14] Signed-off-by: Volodymyr Zhdanov Signed-off-by: Alexander Winkowski --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 68bbb5f0e6f0..3121ad039471 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7438,7 +7438,7 @@ static int start_cpu(struct task_struct *p, bool boosted, } #endif - if (boosted) { + if (boosted && p->prio <= DEFAULT_PRIO) { if (rd->mid_cap_orig_cpu != -1 && task_fits_max(p, rd->mid_cap_orig_cpu)) return rd->mid_cap_orig_cpu; @@ -7879,7 +7879,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, */ if ((prefer_idle && best_idle_cpu != -1) || (boosted && (best_idle_cpu != -1 || target_cpu != -1))) { - if (boosted) { + if (boosted && p->prio <= DEFAULT_PRIO) { if (!next_group_higher_cap) break; } else {