Skip to content

Commit c32b430

Browse files
vingu-linaroPeter Zijlstra
authored andcommitted
sched/fair: Improve spreading of utilization
During load_balancing, a group with spare capacity will try to pull some utilizations from an overloaded group. In such case, the load balance looks for the runqueue with the highest utilization. Nevertheless, it should also ensure that there are some pending tasks to pull otherwise the load balance will fail to pull a task and the spread of the load will be delayed. This situation is quite transient but it's possible to highlight the effect with a short run of sysbench test so the time to spread task impacts the global result significantly. Below are the average results for 15 iterations on an arm64 octo core: sysbench --test=cpu --num-threads=8 --max-requests=1000 run tip/sched/core +patchset total time: 172ms 158ms per-request statistics: avg: 1.337ms 1.244ms max: 21.191ms 10.753ms The average max doesn't fully reflect the wide spread of the value which ranges from 1.350ms to more than 41ms for the tip/sched/core and from 1.350ms to 21ms with the patch. Other factors like waiting for an idle load balance or cache hotness can delay the spreading of the tasks which explains why we can still have up to 21ms with the patch. Signed-off-by: Vincent Guittot <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 26cf522 commit c32b430

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kernel/sched/fair.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9313,6 +9313,14 @@ static struct rq *find_busiest_queue(struct lb_env *env,
93139313
case migrate_util:
93149314
util = cpu_util(cpu_of(rq));
93159315

9316+
/*
9317+
* Don't try to pull utilization from a CPU with one
9318+
* running task. Whatever its utilization, we will fail
9319+
* detach the task.
9320+
*/
9321+
if (nr_running <= 1)
9322+
continue;
9323+
93169324
if (busiest_util < util) {
93179325
busiest_util = util;
93189326
busiest = rq;

0 commit comments

Comments
 (0)