Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp311675iob; Wed, 18 May 2022 02:45:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZneumHUMjVyHMvLIK7/dgyY1mKgXnISg7DshZPjiRvhJaSFLthHWmTdRLtcfNdWVYAb7W X-Received: by 2002:a05:6a00:a26:b0:4fd:f9dd:549c with SMTP id p38-20020a056a000a2600b004fdf9dd549cmr26861398pfh.42.1652867130468; Wed, 18 May 2022 02:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652867130; cv=none; d=google.com; s=arc-20160816; b=TvW00t/rdNsan43GaZQB477yGr7wU4j7ssb0j72+qwxUM2WB/HN/wu+UJz+wPv0n0b tS1EYky/Dzgm6hF31jSE/R7m7PRgm4OyzuAk3EsQTYKqf/HGhKN7tk/SpLKVjYxr6zBD KwfmTt8yI+xaicYQKne3xFyaMejwfmurXth58SdIIlAIJX1w6zeVkb6kggfse+Ay1Whu fqGBnYh4Se32FkGONZKNU3RqMpg+WoOGoR4qEqeINafkpORnJYSVu7DxFoVFM7BP1e9F V8g2mhWvZHFkdrOM0ijGSUeJn3xIuHkURTO9yjPvnO72DsYYZqGABkAJbbBkKHWvZNvN pI/A== 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=pq0oIxHYVhU1analhbLL3cZYaSQJxnn+V4Wia16zsSc=; b=UV9PYTVCoXe9GDsnQmYyJ3OFMHP+H7cmIQ+znsaFDHb63Z4qxnDeTd1c3sMj51SlYy accQ/k/6nJR/gRTiAFeY6PjqkWzDvWxDjIEhBeQRPtGGXZ8sU/4/g2kc9UIymy4JKNWW BDr+tuDaNp2VvKSeyL3KYgz0Zn8lukERZTMExgFOqGnwkpO5rZkBA55ceIs8MzNMNx/k 9iHIcgIOb65PUdtzMNHV8ItccwOg9/zhnjedCCb4PbpO57nhrPB4iMjveaVWyuEDPPQV JyenqYB4Ve5n1oa+dgN/WBs+wA0Lae/DaFaFOOMbP0A/dfNqtae1Sgg1JE9jzBVc37sV TcpQ== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b18-20020a656692000000b003c61ee0c7f6si2042987pgw.552.2022.05.18.02.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 02:45:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B69E95489; Wed, 18 May 2022 02:35:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234341AbiERJeV (ORCPT + 99 others); Wed, 18 May 2022 05:34:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234371AbiERJeI (ORCPT ); Wed, 18 May 2022 05:34:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EF51FB040F for ; Wed, 18 May 2022 02:34:04 -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 9E7EB1042; Wed, 18 May 2022 02:34:04 -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 DC5F33F66F; Wed, 18 May 2022 02:34:02 -0700 (PDT) From: Sudeep Holla To: Atish Patra , linux-kernel@vger.kernel.org Cc: Sudeep Holla , 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 v2 6/8] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Date: Wed, 18 May 2022 10:33:23 +0100 Message-Id: <20220518093325.2070336-7-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220518093325.2070336-1-sudeep.holla@arm.com> References: <20220518093325.2070336-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 be99a78f5b31..6d3346efe74b 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -662,8 +662,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