ACPI/NUMA: A few fixes and cleanups in drivers/acpi/numa/srat.c
cover ACPI/NUMA: A few fixes and cleanups in drivers/acpi/numa/srat.c
This series fixes an issue and does some cleanups in drivers/acpi/numa/srat.c.
Yuntao Wang (3):
ACPI/NUMA: Remove unnecessary check in acpi_parse_gi_affinity() ACPI/NUMA: Optimize the check for the availability of node values ACPI/NUMA: Fix the logic of getting the fake_pxm value
drivers/acpi/numa/srat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/3 ACPI/NUMA: Remove unnecessary check in acpi_parse_gi_affinity()
The acpi_map_pxm_to_node() function will never return a node value that is greater than or equal to MAX_NUMNODES. Remove the unnecessary node >= MAX_NUMNODES check to keep the code consistent with other users of the acpi_map_pxm_to_node() function.
--- drivers/acpi/numa/srat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/numa/srat.c +1 -1
@@ -430,7 +430,7 @@ acpi_parse_gi_affinity(union acpi_subtable_headers *header,return -EINVAL ; node =acpi_map_pxm_to_node (gi_affinity->proximity_domain); -if (node ==NUMA_NO_NODE || node >=MAX_NUMNODES ) { +if (node ==NUMA_NO_NODE ) {pr_err ("SRAT: Too many proximity domains.\n" );return -EINVAL ; }
Signature · 1 line
2.43.0
PATCH 2/3 ACPI/NUMA: Optimize the check for the availability of node values
In reply to Yuntao WangThe 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.
--- drivers/acpi/numa/srat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/numa/srat.c +2 -2
@@ -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); }
Signature · 1 line
2.43.0
PATCH 3/3 ACPI/NUMA: Fix the logic of getting the fake_pxm value
In reply to Yuntao WangThe for loop does not iterate over the last element of the node_to_pxm_map array. This could lead to a conflict between the final fake_pxm value and the existing pxm values. That is, the final fake_pxm value can not be guaranteed to be an unused pxm value.
--- drivers/acpi/numa/srat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/numa/srat.c +2 -2
@@ -183,7 +183,7 @@ static int __init slit_valid(struct acpi_table_slit *slit)int i, j;int d = slit->locality_count;for (i =0 ; i < d; i++) { -for (j =0 ; j < d; j++) { +for (j =0 ; j < d; j++) {u8 val = slit->entry[d*i + j];if (i == j) {if (val !=LOCAL_DISTANCE )
@@ -532,7 +532,7 @@ int __init acpi_numa_init(void)*/ /* fake_pxm is the next unused PXM value after SRAT parsing */ -for (i =0 , fake_pxm =-1 ; i <MAX_NUMNODES -1 ; i++) { +for (i =0 , fake_pxm =-1 ; i <MAX_NUMNODES ; i++) {if (node_to_pxm_map[i] > fake_pxm) fake_pxm = node_to_pxm_map[i]; }
Signature · 1 line
2.43.0
Rafael J. Wysocki
maintainerQuoted 7 lines · Yuntao Wang
This series fixes an issue and does some cleanups in
drivers/acpi/numa/srat.c.Yuntao Wang (3):
ACPI/NUMA: Remove unnecessary check inacpi_parse_gi_affinity()ACPI/NUMA: Optimize the check for the availability of node values ACPI/NUMA: Fix the logic of getting thefake_pxmvalue
All patches applied as 6.8 material with some edits in the changelogs.
Thanks!