Message ID | 20160906130127.GA21960@vingu-laptop |
---|---|
State | New |
Headers | show |
On 6 September 2016 at 15:07, Mike Galbraith <umgwanakikbuti@gmail.com> wrote: > On Tue, 2016-09-06 at 15:01 +0200, Vincent Guittot wrote: >> Le Monday 05 Sep 2016 à 18:26:53 (+0200), Mike Galbraith a écrit : >> > Coming back to this, how about this instead, only increase the group >> > imbalance threshold when sd_llc_size == 2. Newer L3 equipped >> > processors then aren't affected. >> > >> >> Not sure that all systems with sd_llc_size == 2 wants this behavior. >> >> Why not adding a sched_feature for changing the 2nd half of the test >> for some systems ? > > Because users won't know, and shouldn't need to know that they need to > flip that switch. fair enough so how can we detect this specific system configuration ? sd_llc_size == 2 is not enough IMHO > > -Mike
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 4185e0a..65c9363 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7395,9 +7395,14 @@ static struct sched_group *find_busiest_group(struct lb_env *env) * significant if the diff is greater than 1 otherwise we * might end up to just move the imbalance on another group */ - if ((busiest->group_type != group_overloaded) && - (local->idle_cpus <= (busiest->idle_cpus + 1))) - goto out_balanced; + if (busiest->group_type != group_overloaded) { + int imbalance = 1; + if (!sched_feat(BALANCE_IDLE_CPUS)) + imbalance = __this_cpu_read(sd_llc_size); + + if (local->idle_cpus <= busiest->idle_cpus + imbalance) + goto out_balanced; + } } else { /* * In the CPU_NEWLY_IDLE, CPU_NOT_IDLE cases, use diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 69631fa..16c34ec 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -69,3 +69,10 @@ SCHED_FEAT(RT_RUNTIME_SHARE, true) SCHED_FEAT(LB_MIN, false) SCHED_FEAT(ATTACH_AGE_LOAD, true) +/* + * Try to balance the number of idle CPUs in each group to minimize contention + * on shared ressources. Nevertheless, some older systems without L3 seems to + * prefer to share resource for minimizing the migration between groups + */ +SCHED_FEAT(BALANCE_IDLE_CPUS, true) +