From 385215579f6471d33ab842596517a79119881a1f Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Tue, 3 Mar 2020 13:21:46 +0800 Subject: [PATCH] sched/fair: Skip cpu if task does not fit in Previously we skip util check on idle cpu if task prefers idle, but we still need to make sure task fits in that cpu after considering capacity margin (on little cores only). Bug: 147785606 Test: cpu skipped as expected Signed-off-by: Rick Yiu Change-Id: I7c85768ceda94b44052c7c9428fd50088268edad Signed-off-by: Alexander Winkowski --- kernel/sched/fair.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ef23942cf634..f20951e23f5a 100755 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7622,11 +7622,15 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu, * The target CPU can be already at a capacity level higher * than the one required to boost the task. * However, if the task prefers idle cpu and that - * cpu is idle, skip this check. + * cpu is idle, skip this check, but still need to make + * sure the task fits in that cpu after considering + * capacity margin. */ new_util = max(min_util, new_util); - if (!(prefer_idle && idle_cpu(i)) - && new_util > capacity_orig) + if ((!(prefer_idle && idle_cpu(i)) && + new_util > capacity_orig) || + (is_min_capacity_cpu(i) && + !task_fits_capacity(p, capacity_orig, i))) continue; /*