Commit 5f68eb19 authored by Vincent Guittot's avatar Vincent Guittot Committed by Peter Zijlstra

sched/fair : Improve update_sd_pick_busiest for spare capacity case

Similarly to calculate_imbalance() and find_busiest_group(), using the
number of idle CPUs when there is only 1 CPU in the group is not efficient
because we can't make a difference between a CPU running 1 task and a CPU
running dozens of small tasks competing for the same CPU but not enough
to overload it. More generally speaking, we should use the number of
running tasks when there is the same number of idle CPUs in a group instead
of blindly select the 1st one.

When the groups have spare capacity and the same number of idle CPUs, we
compare the number of running tasks to select the busiest group.
Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1576839893-26930-1-git-send-email-vincent.guittot@linaro.org
parent db5793c5
...@@ -8181,14 +8181,18 @@ static bool update_sd_pick_busiest(struct lb_env *env, ...@@ -8181,14 +8181,18 @@ static bool update_sd_pick_busiest(struct lb_env *env,
case group_has_spare: case group_has_spare:
/* /*
* Select not overloaded group with lowest number of * Select not overloaded group with lowest number of idle cpus
* idle cpus. We could also compare the spare capacity * and highest number of running tasks. We could also compare
* which is more stable but it can end up that the * the spare capacity which is more stable but it can end up
* group has less spare capacity but finally more idle * that the group has less spare capacity but finally more idle
* CPUs which means less opportunity to pull tasks. * CPUs which means less opportunity to pull tasks.
*/ */
if (sgs->idle_cpus >= busiest->idle_cpus) if (sgs->idle_cpus > busiest->idle_cpus)
return false; return false;
else if ((sgs->idle_cpus == busiest->idle_cpus) &&
(sgs->sum_nr_running <= busiest->sum_nr_running))
return false;
break; break;
} }
......
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