From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1170577AbdDXNDs (ORCPT ); Mon, 24 Apr 2017 09:03:48 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:45229 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1170468AbdDXNDh (ORCPT ); Mon, 24 Apr 2017 09:03:37 -0400 Date: Mon, 24 Apr 2017 15:03:26 +0200 From: Peter Zijlstra To: Lauro Ramos Venancio Cc: lwang@redhat.com, riel@redhat.com, Mike Galbraith , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] sched/topology: the group balance cpu must be a cpu where the group is installed Message-ID: <20170424130326.nfbaujvcdjca22tl@hirez.programming.kicks-ass.net> References: <1492717903-5195-1-git-send-email-lvenanci@redhat.com> <1492717903-5195-5-git-send-email-lvenanci@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1492717903-5195-5-git-send-email-lvenanci@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 20, 2017 at 04:51:43PM -0300, Lauro Ramos Venancio wrote: > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > index e77c93a..694e799 100644 > --- a/kernel/sched/topology.c > +++ b/kernel/sched/topology.c > @@ -505,7 +507,11 @@ static void build_group_mask(struct sched_domain *sd, struct sched_group *sg) > > for_each_cpu(i, sg_span) { > sibling = *per_cpu_ptr(sdd->sd, i); > - if (!cpumask_test_cpu(i, sched_domain_span(sibling))) > + > + if (!sibling->groups) > + continue; How can this happen? > + > + if (!cpumask_equal(sg_span, sched_group_cpus(sibling->groups))) > continue; > > cpumask_set_cpu(i, sched_group_mask(sg)); > @@ -1482,6 +1502,14 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, > } > } > > + /* Init overlap groups */ > + for_each_cpu(i, cpu_map) { > + for (sd = *per_cpu_ptr(d.sd, i); sd; sd = sd->parent) { > + if (sd->flags & SD_OVERLAP) > + init_overlap_sched_groups(sd); > + } > + } Why does this have to be a whole new loop? This is because in build_group_mask() we could encounter @sibling that were not constructed yet? So this is the primary fix? > + > /* Calculate CPU capacity for physical packages and nodes */ > for (i = nr_cpumask_bits-1; i >= 0; i--) { > if (!cpumask_test_cpu(i, cpu_map)) Also, would it not make sense to re-order patch 2 to come after this, such that we _do_ have the group_mask available and don't have to jump through hoops in order to link up the sgc? Afaict we don't actually use the sgc until the above (reverse) loop computing the CPU capacities.