FROMLIST: sched/fair: Don't move tasks to lower capacity cpus unless necessary
authorChris Redpath <chris.redpath@arm.com>
Wed, 30 May 2018 12:16:41 +0000 (13:16 +0100)
committerChris Redpath <chris.redpath@arm.com>
Wed, 18 Jul 2018 09:42:48 +0000 (10:42 +0100)
When lower capacity CPUs are load balancing and considering to pull
something from a higher capacity group, we should not pull tasks from a
cpu with only one task running as this is guaranteed to impede progress
for that task. If there is more than one task running, load balance in
the higher capacity group would have already made any possible moves to
resolve imbalance and we should make better use of system compute
capacity by moving a task if we still have more than one running.

cc: Ingo Molnar <mingo@redhat.com>
cc: Peter Zijlstra <peterz@infradead.org>

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
[from https://lore.kernel.org/lkml/1530699470-29808-11-git-send-email-morten.rasmussen@arm.com/]
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
Change-Id: Ib86570abdd453a51be885b086c8d80be2773a6f2

kernel/sched/fair.c

index 09304850e3c82b5e2f5ec281383b7185556c3a31..23c5ce715dcc8b3453a1378f2aa170f5d90e8e5f 100644 (file)
@@ -9740,6 +9740,17 @@ static struct rq *find_busiest_queue(struct lb_env *env,
 
                capacity = capacity_of(i);
 
+               /*
+                * For ASYM_CPUCAPACITY domains, don't pick a cpu that could
+                * eventually lead to active_balancing high->low capacity.
+                * Higher per-cpu capacity is considered better than balancing
+                * average load.
+                */
+               if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
+                   capacity_of(env->dst_cpu) < capacity &&
+                   rq->nr_running == 1)
+                       continue;
+
                wl = weighted_cpuload(rq);
 
                /*