Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3608272ioo; Wed, 25 May 2022 04:32:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDTGPNf8XN6he+8LBMc1Tfzipn8qiIBD6y0D+isEjT4zuzpGjs80pQLcawA2kJarbG+iLn X-Received: by 2002:a17:902:d4ce:b0:162:42bd:72e with SMTP id o14-20020a170902d4ce00b0016242bd072emr7669095plg.129.1653478343284; Wed, 25 May 2022 04:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653478343; cv=none; d=google.com; s=arc-20160816; b=I54D78AlB1vhrODucE4N6kHFkucWHSyvVQONHeeqccb7Co9D1mcteYXPjlawwuMcaY eF8qtCAt5Z2yC4Sn9duoEpMrv7ksFoWsRFyJaEg5K5aO+nvUf1SlY22HicqiLcxy/V8s wYmn1glZF/YuH8tfTJWbr0JFdbPWV+9KG9ylLQ2P+MpP9h3+GgizMsId33RgLiXFTP6l nUGfgjV4fW3/HHxFE0czgyHbJB/Smciyc5RrgK9u/Odh9NWIaoZ868UfiolTU4TE+p56 Tt5T5M2WKorJMSNjmBUeQg0oRFZGyaYnzC1sjtWl+WkJMOYnoRecdHisjZfJ0QIEYw9c 33YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7Mj2eb42F8sAv+VsnF46ucNVpwvgeU/40d8tUw/kpz8=; b=qSI2rgVg/C3wL95VV4nGU1pzGSq5uVj2ypUftNZOc7oTq97qsIYEws0OazzDYms50b 8eGfTM8h3LpkK7XnA9FDRwZiCEZgPjVFj/Vimj0zXuqRPtjJDSwT3HxJHOn7sXLhBWAb xN/dt/S/i5nPZFtHeH/fZNU5pVBEzDA6/8REJq4qec26X4PRA5qccn0DGyHKk2ia0O9p gFw2lt1NBBY4No7hCwM1vQD2E3iBAJIBCdxSrvD8eULjADkR+4wBcjSf3C7A28GZIEUA QuwipX+oV9K/BOB0Qzwtpysy+PGsrEGaPQRPJX8c6Tmw70/FB3sjLkhQbwcFNfCQBc/8 y3kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e24-20020a635458000000b003c62d1ccb94si18498961pgm.179.2022.05.25.04.32.09; Wed, 25 May 2022 04:32:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229897AbiEYIQZ (ORCPT + 99 others); Wed, 25 May 2022 04:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240647AbiEYIPE (ORCPT ); Wed, 25 May 2022 04:15:04 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 63B20819A3 for ; Wed, 25 May 2022 01:14:58 -0700 (PDT) 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 1EC3223A; Wed, 25 May 2022 01:14:58 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 44CF63F73D; Wed, 25 May 2022 01:14:56 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring Subject: [PATCH v3 12/16] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Date: Wed, 25 May 2022 09:14:12 +0100 Message-Id: <20220525081416.3306043-13-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525081416.3306043-12-sudeep.holla@arm.com> References: <20220525081416.3306043-1-sudeep.holla@arm.com> <20220525081416.3306043-2-sudeep.holla@arm.com> <20220525081416.3306043-3-sudeep.holla@arm.com> <20220525081416.3306043-4-sudeep.holla@arm.com> <20220525081416.3306043-5-sudeep.holla@arm.com> <20220525081416.3306043-6-sudeep.holla@arm.com> <20220525081416.3306043-7-sudeep.holla@arm.com> <20220525081416.3306043-8-sudeep.holla@arm.com> <20220525081416.3306043-9-sudeep.holla@arm.com> <20220525081416.3306043-10-sudeep.holla@arm.com> <20220525081416.3306043-11-sudeep.holla@arm.com> <20220525081416.3306043-12-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no point in looping through all the CPU's physical package identifier to check if it is valid or not once a CPU which is outside the topology(i.e. outlier CPU) is found. Let us just break out of the loop early in such case. Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index f73a5e669e42..6ae450ca68bb 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -637,8 +637,10 @@ static int __init parse_dt_topology(void) * only mark cores described in the DT as possible. */ for_each_possible_cpu(cpu) - if (cpu_topology[cpu].package_id < 0) + if (cpu_topology[cpu].package_id < 0) { ret = -EINVAL; + break; + } out_map: of_node_put(map); -- 2.36.1