From: Yuntao Wang <ytcoode@gmail.com>
To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Yuntao Wang <ytcoode@gmail.com>
Subject: [PATCH 2/3] ACPI/NUMA: Optimize the check for the availability of node values
Date: Wed, 6 Dec 2023 18:43:17 +0800 [thread overview]
Message-ID: <20231206104318.182759-3-ytcoode@gmail.com> (raw)
In-Reply-To: <20231206104318.182759-1-ytcoode@gmail.com>
The first_unset_node() function returns the first unused node in
nodes_found_map. If all nodes are in use, the function returns
MAX_NUMNODES. We can use this return value to determine whether there are
any available node values in nodes_found_map, eliminating the need to use
the nodes_weight() function to perform this check.
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
drivers/acpi/numa/srat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
index 9d2d0deb256e..d58e5ef424f2 100644
--- a/drivers/acpi/numa/srat.c
+++ b/drivers/acpi/numa/srat.c
@@ -67,9 +67,9 @@ int acpi_map_pxm_to_node(int pxm)
node = pxm_to_node_map[pxm];
if (node == NUMA_NO_NODE) {
- if (nodes_weight(nodes_found_map) >= MAX_NUMNODES)
- return NUMA_NO_NODE;
node = first_unset_node(nodes_found_map);
+ if (node >= MAX_NUMNODES)
+ return NUMA_NO_NODE;
__acpi_map_pxm_to_node(pxm, node);
node_set(node, nodes_found_map);
}
--
2.43.0
next prev parent reply other threads:[~2023-12-06 10:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 10:43 [PATCH 0/3] ACPI/NUMA: A few fixes and cleanups in drivers/acpi/numa/srat.c Yuntao Wang
2023-12-06 10:43 ` [PATCH 1/3] ACPI/NUMA: Remove unnecessary check in acpi_parse_gi_affinity() Yuntao Wang
2023-12-06 10:43 ` Yuntao Wang [this message]
2023-12-06 10:43 ` [PATCH 3/3] ACPI/NUMA: Fix the logic of getting the fake_pxm value Yuntao Wang
2023-12-12 19:37 ` [PATCH 0/3] ACPI/NUMA: A few fixes and cleanups in drivers/acpi/numa/srat.c Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231206104318.182759-3-ytcoode@gmail.com \
--to=ytcoode@gmail.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox