From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9805AC4332F for ; Tue, 8 Mar 2022 16:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:Subject: From:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rDC7IG6WQMMcqPvUvT4CS65jAGzXtFZ4jj7J4UNZJZ0=; b=OaBIsVhm0zHGG+ ugllCpJnHMt5WnprTfpfO7xVzlcttvnC8wghJXfgA9Z4RxWCbJQOH+Lu2MGW435FvrCo5QZvG5YtJ Uc8gegE+d5SIKOQaPdaPdzVq4ucQ3dUuETLY2wp0xf3uWCUfyAfMjENcI6POWIKcFzxMKb6EBdMnd j+sOa8xI38ql+8aVVuEkT2Z1u4rgzaXRZWs1CU51DZxEgAPPZ77IlDnZ/iHcPyxurOSpCXMPNOJsP 1DaGCRlB6q72orHuGO5XmkmpjZJksbvTHjfDacBt4kOz7JkD2sAyJuS6R4lhX93RTTGQtS639Rb1w vzIfSdpmcJGkX4J5IE+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRcSD-0058uG-Jq; Tue, 08 Mar 2022 16:12:55 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRcIn-0056WR-2M for linux-arm-kernel@lists.infradead.org; Tue, 08 Mar 2022 16:03:11 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0CAC139F; Tue, 8 Mar 2022 08:03:05 -0800 (PST) Received: from [192.168.1.10] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7BB13FA45; Tue, 8 Mar 2022 08:03:02 -0800 (PST) Message-ID: Date: Tue, 8 Mar 2022 17:03:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 From: Dietmar Eggemann Subject: Re: [PATCH v3] topology: make core_mask include at least cluster_siblings To: Vincent Guittot , Will Deacon Cc: Darren Hart , LKML , Linux Arm , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Catalin Marinas , Peter Zijlstra , Barry Song , Valentin Schneider , "D . Scott Phillips" , Ilkka Koskinen , stable@vger.kernel.org References: <20220308103012.GA31267@willie-the-truck> Content-Language: en-US In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220308_080309_322077_A4A48B26 X-CRM114-Status: GOOD ( 17.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08/03/2022 12:04, Vincent Guittot wrote: > On Tue, 8 Mar 2022 at 11:30, Will Deacon wrote: [...] >>> --- >>> v1: Drop MC level if coregroup weight == 1 >>> v2: New sd topo in arch/arm64/kernel/smp.c >>> v3: No new topo, extend core_mask to cluster_siblings >>> >>> drivers/base/arch_topology.c | 8 ++++++++ >>> 1 file changed, 8 insertions(+) >>> >>> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c >>> index 976154140f0b..a96f45db928b 100644 >>> --- a/drivers/base/arch_topology.c >>> +++ b/drivers/base/arch_topology.c >>> @@ -628,6 +628,14 @@ const struct cpumask *cpu_coregroup_mask(int cpu) >>> core_mask = &cpu_topology[cpu].llc_sibling; >>> } >>> >>> + /* >>> + * For systems with no shared cpu-side LLC but with clusters defined, >>> + * extend core_mask to cluster_siblings. The sched domain builder will >>> + * then remove MC as redundant with CLS if SCHED_CLUSTER is enabled. IMHO, if core_mask weight is 1, MC will be removed/degenerated anyway. This is what I get on my Ampere Altra (I guess I don't have the ACPI changes which would let to a CLS sched domain): # cat /sys/kernel/debug/sched/domains/cpu0/domain*/name DIE NUMA root@oss-altra01:~# zcat /proc/config.gz | grep SCHED_CLUSTER CONFIG_SCHED_CLUSTER=y >>> + */ >>> + if (cpumask_subset(core_mask, &cpu_topology[cpu].cluster_sibling)) >>> + core_mask = &cpu_topology[cpu].cluster_sibling; >>> + >> >> Sudeep, Vincent, are you happy with this now? > > I would not say that I'm happy because this solution skews the core > cpu mask in order to abuse the scheduler so that it will remove a > wrong but useless level when it will build its domains. > But this works so as long as the maintainer are happy, I'm fine I do not have any better idea than this tweak here either in case the platform can't provide a cleaner setup. Maybe the following is easier to read but then we use '&cpu_topology[cpu].llc_sibling' in cpu_coregroup_mask() already ... @@ -617,6 +617,7 @@ EXPORT_SYMBOL_GPL(cpu_topology); const struct cpumask *cpu_coregroup_mask(int cpu) { const cpumask_t *core_mask = cpumask_of_node(cpu_to_node(cpu)); + const cpumask_t *cluster_mask = cpu_clustergroup_mask(cpu); /* Find the smaller of NUMA, core or LLC siblings */ if (cpumask_subset(&cpu_topology[cpu].core_sibling, core_mask)) { @@ -628,6 +629,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu) core_mask = &cpu_topology[cpu].llc_sibling; } + if (cpumask_subset(core_mask, cluster_mask)) + core_mask = cluster_mask; + return core_mask; } Reviewed-by: Dietmar Eggemann _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel