diff options
author | Vincent Guittot <vincent.guittot@linaro.org> | 2012-11-12 14:43:22 +0100 |
---|---|---|
committer | Vincent Guittot <vincent.guittot@linaro.org> | 2012-11-19 09:52:19 +0100 |
commit | 9fddb442fff074adf508dc7c2e6e5b4d9d4d5ad5 (patch) | |
tree | 4d1684dc5c3b6839d4924cfb57e1ccdb3a493d42 | |
parent | 5a815d79950d8f1d8ec8bf40f578c37c2028d65a (diff) |
sched: pack small tasks: fix update packing domain
Remove some optimization in the buddy selection
Reported-by: Morten Rasmussen <Morten.Rasmussen@arm.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
-rw-r--r-- | kernel/sched/fair.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index dfed9b0a51e..192d26e49c8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -184,23 +184,28 @@ void update_packing_domain(int cpu) while (sd) { struct sched_group *sg = sd->groups; struct sched_group *pack = sg; - struct sched_group *tmp = sg->next; + struct sched_group *tmp; - /* 1st CPU of the sched domain is a good candidate */ - if (id == -1) - id = cpumask_first(sched_domain_span(sd)); + /* The 1st CPU of the local group is a good candidate */ + id = cpumask_first(sched_group_cpus(pack)); /* loop the sched groups to find the best one */ - while (tmp != sg) { - if (tmp->sgp->power * sg->group_weight < - sg->sgp->power * tmp->group_weight) - pack = tmp; - tmp = tmp->next; - } + for (tmp = sg->next; tmp != sg; tmp = tmp->next) { + if (tmp->sgp->power * pack->group_weight > + pack->sgp->power * tmp->group_weight) + continue; + + if ((tmp->sgp->power * pack->group_weight == + pack->sgp->power * tmp->group_weight) + && (cpumask_first(sched_group_cpus(tmp)) >= id)) + continue; + + /* we have found a better group */ + pack = tmp; - /* we have found a better group */ - if (pack != sg) + /* Take the 1st CPU of the new group */ id = cpumask_first(sched_group_cpus(pack)); + } /* Look for another CPU than itself */ if ((id != cpu) |