aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorYuntao Wang <ytcoode@gmail.com>2023-12-06 18:43:17 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-12-12 20:36:18 +0100
commitec0f96260737ae23dcad57463fdc32eba025b11d (patch)
tree9245a1a2b69dd606be21ec3114ae0b376013368c /drivers/acpi
parent9ecc3b38abebd18998af40f42029ba84f3f4311c (diff)
downloadlinux-ec0f96260737ae23dcad57463fdc32eba025b11d.tar.gz
ACPI: NUMA: Optimize the check for the availability of node values
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. Use this return value to determine whether there are any available node values in nodes_found_map, eliminating the need to use nodes_weight() for this purpose. Signed-off-by: Yuntao Wang <ytcoode@gmail.com> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/numa/srat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
index 9d2d0deb256e0..d58e5ef424f28 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);
}