Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp683878imm; Thu, 5 Jul 2018 07:14:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6eAUY7heaOBhYIgWsUzpeiF0eifo9t8NJHHxFMe9gjvEVGUdeLJO9HS6FgeuTgJtA+YnH X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr6416042plh.291.1530800083752; Thu, 05 Jul 2018 07:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530800083; cv=none; d=google.com; s=arc-20160816; b=Eg0/SqIMySkLphEiUrOwuxItma4XdzAMSqe+WGfTCAhajTnw5o0+FnlGbo/p6ABkZZ AFQK/xeWLkd0FX6z4OOC21rmFwlgJeHbght5OnZhC8vWhuMcMPlbpmKozcneHYFOww/c papDzwge8p6LyLd9JHrlomS8Kv/buoy9tQAbtdQkzNN4OU88a/Tbgm2bHFCQWABAFci6 6ZBKoeTQxATdD7TQNP7h2DSIzRmbtlGPsuq8WB5ymTLOchDA7Acqjsv+kBt4JKEZiLI1 TLNH0h6icZB5rJHhSc2sLeURSbZsGV+ACWR60YTxWgyPlwqRJXpDF/q4/CIhXTlZQGgp 77CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=3dJeDbLIMdKNjWcwZUOkGGAdHzyLKSaHP3GIcIqAeK0=; b=dN18wryTSi39P5xpbafRexX8edyxMvxvKnR7L3DB8T+2cGz80CS7ltCzv12R/PMzbo z5VDAcN/goek8T8FP26zLAzNh5Jez8sIzEvq9xNMTsugK+n2bd6VbUMNQ9CVgovIJ4+M HadXwM39m9jFBMccohvz1lrjyW9oCzmoDDAPTW3T5+35k2xZr+7fJjz4PVLkezz8nr8D reSWAio3aHIZxTOnsWSP9LHPf6qE8oLdwjSAJi6CQI3YN+Z7Y08fDe7no/vqyBXvDW3I BkEJpO3GXJThFbJfqRs/9gWzix6UOM/onhLfk3bEhAILAqo9CYOcB1HD5JHarpSFvgFB y35w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3-v6si5403169pgs.172.2018.07.05.07.14.29; Thu, 05 Jul 2018 07:14:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753787AbeGEONy (ORCPT + 99 others); Thu, 5 Jul 2018 10:13:54 -0400 Received: from foss.arm.com ([217.140.101.70]:50540 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753418AbeGEONx (ORCPT ); Thu, 5 Jul 2018 10:13:53 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B56218A; Thu, 5 Jul 2018 07:13:53 -0700 (PDT) Received: from e105550-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 97A1B3F5BA; Thu, 5 Jul 2018 07:13:51 -0700 (PDT) Date: Thu, 5 Jul 2018 15:13:49 +0100 From: Morten Rasmussen To: Quentin Perret Cc: peterz@infradead.org, mingo@redhat.com, valentin.schneider@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, gaku.inami.xh@renesas.com, linux-kernel@vger.kernel.org Subject: Re: [PATCHv4 11/12] sched/core: Disable SD_ASYM_CPUCAPACITY for root_domains without asymmetry Message-ID: <20180705141349.GD8596@e105550-lin.cambridge.arm.com> References: <1530699470-29808-1-git-send-email-morten.rasmussen@arm.com> <1530699470-29808-12-git-send-email-morten.rasmussen@arm.com> <20180705133142.GD32579@e108498-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180705133142.GD32579@e108498-lin.cambridge.arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 05, 2018 at 02:31:43PM +0100, Quentin Perret wrote: > Hi Morten, > > On Wednesday 04 Jul 2018 at 11:17:49 (+0100), Morten Rasmussen wrote: > > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > > index 71330e0e41db..29c186961345 100644 > > --- a/kernel/sched/topology.c > > +++ b/kernel/sched/topology.c > > @@ -1160,6 +1160,26 @@ sd_init(struct sched_domain_topology_level *tl, > > sd_id = cpumask_first(sched_domain_span(sd)); > > > > /* > > + * Check if cpu_map eclipses cpu capacity asymmetry. > > + */ > > + > > + if (sd->flags & SD_ASYM_CPUCAPACITY) { > > + int i; > > + bool disable = true; > > + long capacity = arch_scale_cpu_capacity(NULL, sd_id); > > + > > + for_each_cpu(i, sched_domain_span(sd)) { > > + if (capacity != arch_scale_cpu_capacity(NULL, i)) { > > + disable = false; > > + break; > > + } > > + } > > + > > + if (disable) > > + sd->flags &= ~SD_ASYM_CPUCAPACITY; > > + } > > + > > + /* > > * Convert topological properties into behaviour. > > */ > > If SD_ASYM_CPUCAPACITY means that some CPUs have different > arch_scale_cpu_capacity() values, we could also automatically _set_ > the flag in sd_init() no ? Why should we let the arch set it and just > correct it later ? > > I understand the moment at which we know the capacities of CPUs varies > from arch to arch, but the arch code could just call > rebuild_sched_domain when the capacities of CPUs change and let the > scheduler detect things automatically. I mean, even if the arch code > sets the flag in its topology level table, it will have to rebuild > the sched domains anyway ... > > What do you think ? We could as well set the flag here so the architecture doesn't have to do it. It is a bit more complicated though for few reasons: 1. Detecting when to disable the flag is a lot simpler than checking which level is should be set on. You basically have to work you way up from the lowest topology level until you get to a level spanning all the capacities available in the system to figure out where the flag should be set. I don't think this fits easily with how we build the sched_domain hierarchy. It can of course be done. 2. As you say, we still need the arch code (or cpufreq?) to rebuild the whole thing once we know that the capacities have been determined. That currently implies implementing arch_update_cpu_topology() which is arch-specific. So we would need some arch code to make rebuild happen at the right point in time. If the rebuild should be triggering the rebuild we need another way to force a full rebuild. This can also be done. 3. Detecting the flag in generic kernel/sched/* code means that all architectures will pay the for the overhead when building/rebuilding the sched_domain hierarchy, and all architectures that sets the cpu capacities to asymmetric will set the flag whether they like it or not. I'm not sure if this is a problem. In the end it is really about how much of this we want in generic code and how much we hide in arch/, and if we dare to touch the sched_domain build code ;-) Morten