Skip to content

Commit ae2c6dc

Browse files
rientjesLinus Torvalds
authored andcommitted
x86_64: various cleanups in NUMA scan node
In acpi_scan_nodes(), we immediately return -1 if acpi_numa <= 0, meaning we haven't detected any underlying ACPI topology or we have explicitly disabled its use from the command-line with numa=noacpi. acpi_table_print_srat_entry() and acpi_table_parse_srat() are only referenced within drivers/acpi/numa.c, so we can mark them as static and remove their prototypes from the header file. Likewise, pxm_to_node_map[] and node_to_pxm_map[] are only used within drivers/acpi/numa.c, so we mark them as static and remove their externs from the header file. The automatic 'result' variable is unused in acpi_numa_init(), so it's removed. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a2e212d commit ae2c6dc

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

arch/x86_64/mm/srat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
394394
{
395395
int i;
396396

397+
if (acpi_numa <= 0)
398+
return -1;
399+
397400
/* First clean up the node list */
398401
for (i = 0; i < MAX_NUMNODES; i++) {
399402
cutoff_node(i, start, end);
@@ -403,9 +406,6 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
403406
}
404407
}
405408

406-
if (acpi_numa <= 0)
407-
return -1;
408-
409409
if (!nodes_cover_memory()) {
410410
bad_srat();
411411
return -1;

drivers/acpi/numa.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ static nodemask_t nodes_found_map = NODE_MASK_NONE;
4040
#define NID_INVAL -1
4141

4242
/* maps to convert between proximity domain and logical node ID */
43-
static int pxm_to_node_map[MAX_PXM_DOMAINS]
43+
static int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS]
4444
= { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL };
45-
static int node_to_pxm_map[MAX_NUMNODES]
45+
static int __cpuinitdata node_to_pxm_map[MAX_NUMNODES]
4646
= { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
4747

4848
int pxm_to_node(int pxm)
@@ -83,7 +83,8 @@ void __cpuinit acpi_unmap_pxm_to_node(int node)
8383
node_clear(node, nodes_found_map);
8484
}
8585

86-
void __init acpi_table_print_srat_entry(struct acpi_subtable_header * header)
86+
static void __init
87+
acpi_table_print_srat_entry(struct acpi_subtable_header *header)
8788
{
8889

8990
ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
@@ -200,7 +201,7 @@ static int __init acpi_parse_srat(struct acpi_table_header *table)
200201
return 0;
201202
}
202203

203-
int __init
204+
static int __init
204205
acpi_table_parse_srat(enum acpi_srat_type id,
205206
acpi_table_entry_handler handler, unsigned int max_entries)
206207
{
@@ -211,14 +212,13 @@ acpi_table_parse_srat(enum acpi_srat_type id,
211212

212213
int __init acpi_numa_init(void)
213214
{
214-
int result;
215-
216215
/* SRAT: Static Resource Affinity Table */
217216
if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
218-
result = acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
219-
acpi_parse_processor_affinity,
220-
NR_CPUS);
221-
result = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
217+
acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
218+
acpi_parse_processor_affinity, NR_CPUS);
219+
acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
220+
acpi_parse_memory_affinity,
221+
NR_NODE_MEMBLKS);
222222
}
223223

224224
/* SLIT: System Locality Information Table */

include/linux/acpi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@ int acpi_table_parse (char *id, acpi_table_handler handler);
8888
int __init acpi_table_parse_entries(char *id, unsigned long table_size,
8989
int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
9090
int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
91-
int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
9291
int acpi_parse_mcfg (struct acpi_table_header *header);
9392
void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
94-
void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
9593

9694
/* the following four functions are architecture-dependent */
9795
#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT

0 commit comments

Comments
 (0)