Commit b0fb1eb4 authored by Vincent Guittot's avatar Vincent Guittot Committed by Ingo Molnar

sched/fair: Use load instead of runnable load in load_balance()

'runnable load' was originally introduced to take into account the case
where blocked load biases the load balance decision which was selecting
underutilized groups with huge blocked load whereas other groups were
overloaded.

The load is now only used when groups are overloaded. In this case,
it's worth being conservative and taking into account the sleeping
tasks that might wake up on the CPU.
Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Morten.Rasmussen@arm.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: hdanton@sina.com
Cc: parth@linux.ibm.com
Cc: pauld@redhat.com
Cc: quentin.perret@arm.com
Cc: riel@surriel.com
Cc: srikar@linux.vnet.ibm.com
Cc: valentin.schneider@arm.com
Link: https://lkml.kernel.org/r/1571405198-27570-7-git-send-email-vincent.guittot@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 5e23e474
...@@ -5375,6 +5375,11 @@ static unsigned long cpu_runnable_load(struct rq *rq) ...@@ -5375,6 +5375,11 @@ static unsigned long cpu_runnable_load(struct rq *rq)
return cfs_rq_runnable_load_avg(&rq->cfs); return cfs_rq_runnable_load_avg(&rq->cfs);
} }
static unsigned long cpu_load(struct rq *rq)
{
return cfs_rq_load_avg(&rq->cfs);
}
static unsigned long capacity_of(int cpu) static unsigned long capacity_of(int cpu)
{ {
return cpu_rq(cpu)->cpu_capacity; return cpu_rq(cpu)->cpu_capacity;
...@@ -8049,7 +8054,7 @@ static inline void update_sg_lb_stats(struct lb_env *env, ...@@ -8049,7 +8054,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
if ((env->flags & LBF_NOHZ_STATS) && update_nohz_stats(rq, false)) if ((env->flags & LBF_NOHZ_STATS) && update_nohz_stats(rq, false))
env->flags |= LBF_NOHZ_AGAIN; env->flags |= LBF_NOHZ_AGAIN;
sgs->group_load += cpu_runnable_load(rq); sgs->group_load += cpu_load(rq);
sgs->group_util += cpu_util(i); sgs->group_util += cpu_util(i);
sgs->sum_h_nr_running += rq->cfs.h_nr_running; sgs->sum_h_nr_running += rq->cfs.h_nr_running;
...@@ -8507,7 +8512,7 @@ static struct sched_group *find_busiest_group(struct lb_env *env) ...@@ -8507,7 +8512,7 @@ static struct sched_group *find_busiest_group(struct lb_env *env)
init_sd_lb_stats(&sds); init_sd_lb_stats(&sds);
/* /*
* Compute the various statistics relavent for load balancing at * Compute the various statistics relevant for load balancing at
* this level. * this level.
*/ */
update_sd_lb_stats(env, &sds); update_sd_lb_stats(env, &sds);
...@@ -8667,11 +8672,10 @@ static struct rq *find_busiest_queue(struct lb_env *env, ...@@ -8667,11 +8672,10 @@ static struct rq *find_busiest_queue(struct lb_env *env,
switch (env->migration_type) { switch (env->migration_type) {
case migrate_load: case migrate_load:
/* /*
* When comparing with load imbalance, use * When comparing with load imbalance, use cpu_load()
* cpu_runnable_load() which is not scaled with the CPU * which is not scaled with the CPU capacity.
* capacity.
*/ */
load = cpu_runnable_load(rq); load = cpu_load(rq);
if (nr_running == 1 && load > env->imbalance && if (nr_running == 1 && load > env->imbalance &&
!check_cpu_capacity(rq, env->sd)) !check_cpu_capacity(rq, env->sd))
...@@ -8679,10 +8683,10 @@ static struct rq *find_busiest_queue(struct lb_env *env, ...@@ -8679,10 +8683,10 @@ static struct rq *find_busiest_queue(struct lb_env *env,
/* /*
* For the load comparisons with the other CPUs, * For the load comparisons with the other CPUs,
* consider the cpu_runnable_load() scaled with the CPU * consider the cpu_load() scaled with the CPU
* capacity, so that the load can be moved away from * capacity, so that the load can be moved away
* the CPU that is potentially running at a lower * from the CPU that is potentially running at a
* capacity. * lower capacity.
* *
* Thus we're looking for max(load_i / capacity_i), * Thus we're looking for max(load_i / capacity_i),
* crosswise multiplication to rid ourselves of the * crosswise multiplication to rid ourselves of the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment