Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3175171pxb; Mon, 24 Jan 2022 04:14:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzk3G3E9tqHXeiDrnd5PFrF973F3Q5cf/RcTNAdiCQgATW4IiOcZUASDYSYH+/m28TklJt1 X-Received: by 2002:a62:7e53:0:b0:4c7:c1a3:3911 with SMTP id z80-20020a627e53000000b004c7c1a33911mr10279911pfc.13.1643026475350; Mon, 24 Jan 2022 04:14:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643026475; cv=none; d=google.com; s=arc-20160816; b=nzVlIswTtpepWOTXkc7zXqr3oUvcAuohvWdhD2Wv7pevJTLjH1CMFLV3+16JzpdgOD NUl4x0sCi46LVRRLB3PMtBEeeD47zlm9FgJdY0676uPmcJIXI8ZAkkNVoazRHKTOzEnC Jxi5nVOMSMQzSYZdUqm1ajEV7QY7j62tqebmwz3/0YfgrLWXV74YnGkkc5uuiWQUisKP 0hJhbHbS/hxnyU6ldo8E0anpUVMYbc4B5X5ofWHsODary/qntyGsoaIU0q3hHTkxFUhK EG1CSeKc7zJ0IeD+XpGAt1u0Q1PWKq0T0+S0YspA4V6K1ZlBx/88SQwG6ea5HhkiWOG9 GzAQ== 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:to:from :dkim-signature; bh=Va/u2iX1YVOINaxIuJLKJ3LTGOLOqvsNjPRhFp+Rqeo=; b=1FOa2TYUzcoykz22rnz3khTp3HPJyXAN3RgkBGN3c+kwMJt03ebzvvmCcMJ+b4Jp3F JqyNoPwkht++Cft7RVXRk9hgAgL9ntYQusAXlEhtas39lcNUtF3zjgStKG3/aocAR/9+ 3+js9CseJpyRCEite/yggSJTbAAGUiGEKzfKCL3OBo7yhOKWLOVDedfGDYcd4rVMBzki +CD5iEzQMAEauOiBkV0JZ/90itiFOsrSqN1kxLH36qw638SCh2VQXa05dyPS88aMu4wm SC3Osdi3eE0J+eIZCSRVjJxfuBS0BN1V6xVPIF7GSUipEKMvl7MAf0K3RRDgKaeSPveH WHmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eagkQ6Q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h124si13193498pgc.65.2022.01.24.04.14.23; Mon, 24 Jan 2022 04:14:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eagkQ6Q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239764AbiAWSlz (ORCPT + 99 others); Sun, 23 Jan 2022 13:41:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239923AbiAWSlL (ORCPT ); Sun, 23 Jan 2022 13:41:11 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED325C06176A for ; Sun, 23 Jan 2022 10:41:10 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id n8so13503017plc.3 for ; Sun, 23 Jan 2022 10:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Va/u2iX1YVOINaxIuJLKJ3LTGOLOqvsNjPRhFp+Rqeo=; b=eagkQ6Q6MYIyUa2gGTCr0XP5Aj+BdjWz9lZgHECpuGLi3hniUg1vL04exTfY56Hd1E UQYcD0Az1f9gMpbExHH7+zle8nBUUcfkZnNB1N4d7yIalhSNXjF7FSmEJjs4Bo0exVu/ YCP495oGvt7PpQvBlyvD+w0qqqR7r/LG0ES5OU2Ogjc+uci4x3heIZYQMjeVZ4FrQ5FV 1W2RBQfKY1WNoTa6PY8XqJk7Lc3XawRe+hoQeiDVpxs8buZgdFT9jX1YsYXTbCfAQ6br vBCq01+NLc+plLrUmN/sZDmpb91ldk9OK1uKeec/eXNC3RqATlokAapxKDgOge4P9Aat X3Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Va/u2iX1YVOINaxIuJLKJ3LTGOLOqvsNjPRhFp+Rqeo=; b=PdRLn2Bn+P4bZCI4VgP2+EBlRH+xTr+tSh1W8QIRXmfZ4OYZv/GmoCT2yi9uQg6q9l Dj9ZTI8FpFGXEqZVNqodheTgJnVWK77L9flxFCTToOTVDfzhqOcKFBoWTXdz2QY1erUm OSs1LETZq9iIt9xBcBMPRK5jKHBweceMWs3sLWYllYbnmY7lPeOg7T6/VNXJPGd0jM11 nR1K+npjbgilKxZenigqeL4BQTEZncS77YQCZ3rYKO+C1SB+9w81y0ejxeJkM+XncKBL MgMfZVWSJIM3urHbovqBAcMIgsoS43sHZixVyzG5Pv3+s6HatFoRQSubFkFjQ/Y+uICe Q1dQ== X-Gm-Message-State: AOAM531VtPKLmNtwNfk77u4iaSpJYjz2uE2xLQQxwEhNLgB6ABcxKZCa txLYfNjGF26Z5xiSe48Wm04= X-Received: by 2002:a17:90a:4601:: with SMTP id w1mr10006540pjg.113.1642963270445; Sun, 23 Jan 2022 10:41:10 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id l17sm216332pfu.61.2022.01.23.10.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:10 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org Subject: [PATCH 26/54] arch/x86: replace nodes_weight with nodes_empty where appropriate Date: Sun, 23 Jan 2022 10:38:57 -0800 Message-Id: <20220123183925.1052919-27-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mm code calls nodes_weight() to check if any bit of a given nodemask is set. We can do it more efficiently with nodes_empty() because nodes_empty() stops traversing the nodemask as soon as it finds first set bit, while nodes_weight() counts all bits unconditionally. Signed-off-by: Yury Norov --- arch/x86/mm/amdtopology.c | 2 +- arch/x86/mm/numa_emulation.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c index 058b2f36b3a6..b3ca7d23e4b0 100644 --- a/arch/x86/mm/amdtopology.c +++ b/arch/x86/mm/amdtopology.c @@ -154,7 +154,7 @@ int __init amd_numa_init(void) node_set(nodeid, numa_nodes_parsed); } - if (!nodes_weight(numa_nodes_parsed)) + if (nodes_empty(numa_nodes_parsed)) return -ENOENT; /* diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index 1a02b791d273..9a9305367fdd 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -123,7 +123,7 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei, * Continue to fill physical nodes with fake nodes until there is no * memory left on any of them. */ - while (nodes_weight(physnode_mask)) { + while (!nodes_empty(physnode_mask)) { for_each_node_mask(i, physnode_mask) { u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN); u64 start, limit, end; @@ -270,7 +270,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei, * Fill physical nodes with fake nodes of size until there is no memory * left on any of them. */ - while (nodes_weight(physnode_mask)) { + while (!nodes_empty(physnode_mask)) { for_each_node_mask(i, physnode_mask) { u64 dma32_end = PFN_PHYS(MAX_DMA32_PFN); u64 start, limit, end; -- 2.30.2