sched: Fix domain iteration
Commit-ID: c1174876874dcf8986806e4dad3d7d07af20b439 Gitweb: http://git.kernel.org/tip/c1174876874dcf8986806e4dad3d7d07af20b439 Author: Peter Zijlstra <[email protected]> AuthorDate: Thu, 31 May 2012 14:47:33 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 6 Jun 2012 16:52:26 +0200
sched: Fix domain iteration
Weird topologies can lead to asymmetric domain setups. This needs further consideration since these setups are typically non-minimal too.
For now, make it work by adding an extra mask selecting which CPUs are allowed to iterate up.
The topology that triggered it is the one from David Rientjes:
10 20 20 30 20 10 20 20 20 20 10 20 30 20 20 10
resulting in boxes that wouldn't even boot.
Reported-by David Rientjes <[email protected]>
Signed-off-by Peter Zijlstra <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- include/linux/sched.h | 11 ++++++++ kernel/sched/core.c | 64 ++++++++++++++++++++++++++++++++++++++++++------ kernel/sched/fair.c | 5 ++- kernel/sched/sched.h | 2 + 4 files changed, 72 insertions(+), 10 deletions(-)
include/linux/sched.h +11 -0
@@ -876,6 +876,8 @@ struct sched_group_power {* Number of busy cpus in this group. */ atomic_t nr_busy_cpus; + +unsigned long cpumask[0 ];/* iteration mask */ };struct sched_group {
@@ -900,6 +902,15 @@ static inline struct cpumask *sched_group_cpus(struct sched_group *sg)return to_cpumask (sg->cpumask); } +/* +* cpumask masking which cpus in the group are allowed to iterate up the domain +* tree. +*/ +static inline struct cpumask *sched_group_mask (struct sched_group *sg) +{ +return to_cpumask (sg->sgp->cpumask); +} +/** * group_first_cpu - Returns the first cpu in the cpumask of a sched_group. * @group: The group whose first cpu is to be returned.
kernel/sched/core.c +56 -8
109 lines not on this page · raw message
kernel/sched/fair.c +3 -2
@@ -3652,7 +3652,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,int i;if (local_group) - balance_cpu =group_first_cpu (group); + balance_cpu =group_balance_cpu (group);/* Tally up the load of all CPUs in the group */ max_cpu_load =0 ;
@@ -3667,7 +3667,8 @@ static inline void update_sg_lb_stats(struct lb_env *env,/* Bias balancing toward cpus of our domain */ if (local_group) { -if (idle_cpu (i) && !first_idle_cpu) { +if (idle_cpu (i) && !first_idle_cpu && +cpumask_test_cpu (i,sched_group_mask (group))) { first_idle_cpu =1 ; balance_cpu = i; }
kernel/sched/sched.h +2 -0
@@ -526,6 +526,8 @@ static inline struct sched_domain *highest_flag_domain(int cpu, int flag) DECLARE_PER_CPU(struct sched_domain *, sd_llc);DECLARE_PER_CPU (int, sd_llc_id); +extern int group_balance_cpu (struct sched_group *sg); +#endif /* CONFIG_SMP */ #include "stats.h"