From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751300AbcGMMVI (ORCPT ); Wed, 13 Jul 2016 08:21:08 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:33776 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbcGMMVA (ORCPT ); Wed, 13 Jul 2016 08:21:00 -0400 MIME-Version: 1.0 In-Reply-To: <1466615004-3503-4-git-send-email-morten.rasmussen@arm.com> References: <1466615004-3503-1-git-send-email-morten.rasmussen@arm.com> <1466615004-3503-4-git-send-email-morten.rasmussen@arm.com> From: Vincent Guittot Date: Wed, 13 Jul 2016 14:20:24 +0200 Message-ID: Subject: Re: [PATCH v2 03/13] sched/fair: Optimize find_idlest_cpu() when there is no choice To: Morten Rasmussen Cc: Peter Zijlstra , "mingo@redhat.com" , Dietmar Eggemann , Yuyang Du , mgalbraith@suse.de, linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22 June 2016 at 19:03, 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 | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index eec8e29104f9..216db302e87d 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5123,6 +5123,10 @@ 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)); > + > /* Traverse only the allowed CPUs */ > for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) { > if (idle_cpu(i)) { FWIW, you can add my Acked-by: : Vincent Guittot > -- > 1.9.1 >