History

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.

Vincent Guittot committed 6 years ago

Commit c32b4301 parent 26cf5221 file · +8 −0Browse files

Unified · Split

kernel/sched/fair.c+8−0
@@ -9313,6 +9313,14 @@ static struct rq *find_busiest_queue(struct lb_env *env, · 9312 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t