summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-04-07 18:00:53 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-04-07 18:00:53 -0400
commitb678c91aefa7ce05a5d195e0a5c7a357b62d3283 (patch)
treeb7880634b8e07e9e1ed06140fce8ac3912e3ec69
parent1d33b219563fb9f7384c8c609c767cb6bfd44b8e (diff)
Revert "x86/mm/numa: Remove numa_nodemask_from_meminfo()"
This reverts commit 474aeffd88b87746a75583f356183d5c6caa4213 due to testing failures. Reported-by: "Kirill A. Shutemov" <kirill@shutemov.name> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Wei Yang <richard.weiyang@gmail.com> Cc: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20170406124459.dwn5zhpr2xqg3lqm@node.shutemov.name
-rw-r--r--arch/x86/mm/numa.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 175f54ac6772..93671d8b3b0d 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -314,6 +314,20 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi)
314 return 0; 314 return 0;
315} 315}
316 316
317/*
318 * Set nodes, which have memory in @mi, in *@nodemask.
319 */
320static void __init numa_nodemask_from_meminfo(nodemask_t *nodemask,
321 const struct numa_meminfo *mi)
322{
323 int i;
324
325 for (i = 0; i < ARRAY_SIZE(mi->blk); i++)
326 if (mi->blk[i].start != mi->blk[i].end &&
327 mi->blk[i].nid != NUMA_NO_NODE)
328 node_set(mi->blk[i].nid, *nodemask);
329}
330
317/** 331/**
318 * numa_reset_distance - Reset NUMA distance table 332 * numa_reset_distance - Reset NUMA distance table
319 * 333 *
@@ -333,12 +347,16 @@ void __init numa_reset_distance(void)
333 347
334static int __init numa_alloc_distance(void) 348static int __init numa_alloc_distance(void)
335{ 349{
350 nodemask_t nodes_parsed;
336 size_t size; 351 size_t size;
337 int i, j, cnt = 0; 352 int i, j, cnt = 0;
338 u64 phys; 353 u64 phys;
339 354
340 /* size the new table and allocate it */ 355 /* size the new table and allocate it */
341 for_each_node_mask(i, numa_nodes_parsed) 356 nodes_parsed = numa_nodes_parsed;
357 numa_nodemask_from_meminfo(&nodes_parsed, &numa_meminfo);
358
359 for_each_node_mask(i, nodes_parsed)
342 cnt = i; 360 cnt = i;
343 cnt++; 361 cnt++;
344 size = cnt * cnt * sizeof(numa_distance[0]); 362 size = cnt * cnt * sizeof(numa_distance[0]);
@@ -517,6 +535,7 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
517 535
518 /* Account for nodes with cpus and no memory */ 536 /* Account for nodes with cpus and no memory */
519 node_possible_map = numa_nodes_parsed; 537 node_possible_map = numa_nodes_parsed;
538 numa_nodemask_from_meminfo(&node_possible_map, mi);
520 if (WARN_ON(nodes_empty(node_possible_map))) 539 if (WARN_ON(nodes_empty(node_possible_map)))
521 return -EINVAL; 540 return -EINVAL;
522 541