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 <rickyiu@google.com>
Change-Id: I7c85768ceda94b44052c7c9428fd50088268edad
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
fourteen
Rick Yiu 5 years ago committed by Jenna
parent 30b1a73858
commit 385215579f
  1. 10
      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;
/*

Loading…
Cancel
Save