On Mon, May 23, 2016 at 11:58:46AM +0100, Morten Rasmussen wrote: > In the current find_idlest_group()/find_idlest_cpu() search we end up > calling find_idlest_cpu() in a sched_group containing only one cpu in > the end. Checking idle-states becomes pointless when there is no > alternative, so bail out instead. > > cc: Ingo Molnar <[email protected]> > cc: Peter Zijlstra <[email protected]> > > Signed-off-by: Morten Rasmussen <[email protected]> > --- > kernel/sched/fair.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 0fe3020..564215d 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5155,6 +5155,11 @@ find_idlest_cpu(struct sched_group *group, struct > task_struct *p, int this_cpu) > int shallowest_idle_cpu = -1; > int i; > > + /* Check if we have any choice */ > + if (group->group_weight == 1) { > + return cpumask_first(sched_group_cpus(group)); > + }
superfluous brackets, also isn't @this_cpu supposed to be part of the sched_group_cpu(group) mask?

