Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754168AbdHUUWO (ORCPT ); Mon, 21 Aug 2017 16:22:14 -0400 Received: from merlin.infradead.org ([205.233.59.134]:42294 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753790AbdHUUWN (ORCPT ); Mon, 21 Aug 2017 16:22:13 -0400 Date: Mon, 21 Aug 2017 22:22:00 +0200 From: Peter Zijlstra To: Brendan Jackman Cc: Josef Bacik , linux-kernel@vger.kernel.org, Joel Fernandes , Andres Oportus , Ingo Molnar , Morten Rasmussen , Dietmar Eggemann , Vincent Guittot Subject: Re: [PATCH 2/2] sched/fair: Fix use of NULL with find_idlest_group Message-ID: <20170821202200.GE32112@worktop.programming.kicks-ass.net> References: <20170821152128.14418-1-brendan.jackman@arm.com> <20170821152128.14418-3-brendan.jackman@arm.com> <20170821172622.GA23807@destiny> <87fuck3ipr.fsf@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fuck3ipr.fsf@arm.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1217 Lines: 30 On Mon, Aug 21, 2017 at 06:59:28PM +0100, Brendan Jackman wrote: > Hi Josef, > > Thanks for taking a look. > > On Mon, Aug 21 2017 at 17:26, Josef Bacik wrote: > > On Mon, Aug 21, 2017 at 04:21:28PM +0100, Brendan Jackman wrote: > [...] > >> - local_group = cpumask_test_cpu(this_cpu, > >> - sched_group_span(group)); > >> - > > > > This isn't right is it? cpu isn't necessarily in the very first group of a sd > > right? > > I think it is - I haven't grokked the sd/sg setup code in > kernel/sched/topology.c but there is a comment[1] that I interpret as > saying this. I'll take a more careful look tomorrow. > > [1] http://elixir.free-electrons.com/linux/v4.13-rc6/source/kernel/sched/topology.c#L786 > > If I'm wrong, this can be rewritten not to use that assumption - I did > it this way in the caller ("else if (group == sd->groups)") because I > didn't want to use cpumask_test_cpu, and then changed it inside > find_idlest_group so there weren't two ways of doing the same thing in > the same neighbourhood of code. No you are quite correct. The sched_domain of a CPU always includes that CPU and the first group of a sched_domain is it's child domain and therefore also includes that CPU.