From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754351AbcEXG3L (ORCPT ); Tue, 24 May 2016 02:29:11 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33458 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754220AbcEXG3J (ORCPT ); Tue, 24 May 2016 02:29:09 -0400 Message-ID: <1464071345.3743.22.camel@gmail.com> Subject: Re: [PATCH 04/16] sched/fair: Optimize find_idlest_cpu() when there is no choice From: Mike Galbraith To: Morten Rasmussen , peterz@infradead.org, mingo@redhat.com Cc: dietmar.eggemann@arm.com, yuyang.du@intel.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Date: Tue, 24 May 2016 08:29:05 +0200 In-Reply-To: <1464001138-25063-5-git-send-email-morten.rasmussen@arm.com> References: <1464001138-25063-1-git-send-email-morten.rasmussen@arm.com> <1464001138-25063-5-git-send-email-morten.rasmussen@arm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-05-23 at 11:58 +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 > cc: Peter Zijlstra > > Signed-off-by: Morten Rasmussen > --- > 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)); > +> > } > + Hm, if task isn't allowed there, too bad? > /* Traverse only the allowed CPUs */ > > > for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) { > > > > if (idle_cpu(i)) {