Skip to content

Commit e4d32e4

Browse files
vingu-linaroPeter Zijlstra
authored andcommitted
sched/fair: Minimize concurrent LBs between domain level
sched domains tend to trigger simultaneously the load balance loop but the larger domains often need more time to collect statistics. This slowness makes the larger domain trying to detach tasks from a rq whereas tasks already migrated somewhere else at a sub-domain level. This is not a real problem for idle LB because the period of smaller domains will increase with its CPUs being busy and this will let time for higher ones to pulled tasks. But this becomes a problem when all CPUs are already busy because all domains stay synced when they trigger their LB. A simple way to minimize simultaneous LB of all domains is to decrement the the busy interval by 1 jiffies. Because of the busy_factor, the interval of larger domain will not be a multiple of smaller ones anymore. Signed-off-by: Vincent Guittot <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Phil Auld <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 2208cda commit e4d32e4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/sched/fair.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9790,6 +9790,15 @@ get_sd_balance_interval(struct sched_domain *sd, int cpu_busy)
97909790

97919791
/* scale ms to jiffies */
97929792
interval = msecs_to_jiffies(interval);
9793+
9794+
/*
9795+
* Reduce likelihood of busy balancing at higher domains racing with
9796+
* balancing at lower domains by preventing their balancing periods
9797+
* from being multiples of each other.
9798+
*/
9799+
if (cpu_busy)
9800+
interval -= 1;
9801+
97939802
interval = clamp(interval, 1UL, max_load_balance_interval);
97949803

97959804
return interval;

0 commit comments

Comments
 (0)