aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/numa_64.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2011-02-21 04:58:13 -0500
committerTejun Heo <tj@kernel.org>2011-02-21 05:23:31 -0500
commit69efcc6d90d234a3a076afb2c635c1609536faa4 (patch)
tree69c4032f04de1e9dc8add8a944b13b4f3c05814a /arch/x86/mm/numa_64.c
parent6d496f9f232790d44144f3784856290e0b27b8f3 (diff)
x86-64, NUMA: Do not scan two times for setup_node_bootmem()
By the time setup_node_bootmem() is called, all the memblocks are already registered. As node_data is allocated from these memblocks, calling it more than once doesn't make any difference. Drop the loop. tj: Dropped comment referencing to the old behavior as suggested by David and rephrased the description. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/mm/numa_64.c')
-rw-r--r--arch/x86/mm/numa_64.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index f6d85e380471..6e4ee96d1b11 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -480,7 +480,7 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
480 480
481static int __init numa_register_memblks(struct numa_meminfo *mi) 481static int __init numa_register_memblks(struct numa_meminfo *mi)
482{ 482{
483 int i, j, nid; 483 int i, nid;
484 484
485 /* Account for nodes with cpus and no memory */ 485 /* Account for nodes with cpus and no memory */
486 node_possible_map = numa_nodes_parsed; 486 node_possible_map = numa_nodes_parsed;
@@ -506,28 +506,20 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
506 506
507 init_memory_mapping_high(); 507 init_memory_mapping_high();
508 508
509 /* 509 /* Finally register nodes. */
510 * Finally register nodes. Do it twice in case setup_node_bootmem 510 for_each_node_mask(nid, node_possible_map) {
511 * missed one due to missing bootmem. 511 u64 start = (u64)max_pfn << PAGE_SHIFT;
512 */ 512 u64 end = 0;
513 for (i = 0; i < 2; i++) {
514 for_each_node_mask(nid, node_possible_map) {
515 u64 start = (u64)max_pfn << PAGE_SHIFT;
516 u64 end = 0;
517 513
518 if (node_online(nid)) 514 for (i = 0; i < mi->nr_blks; i++) {
515 if (nid != mi->blk[i].nid)
519 continue; 516 continue;
520 517 start = min(mi->blk[i].start, start);
521 for (j = 0; j < mi->nr_blks; j++) { 518 end = max(mi->blk[i].end, end);
522 if (nid != mi->blk[j].nid)
523 continue;
524 start = min(mi->blk[j].start, start);
525 end = max(mi->blk[j].end, end);
526 }
527
528 if (start < end)
529 setup_node_bootmem(nid, start, end);
530 } 519 }
520
521 if (start < end)
522 setup_node_bootmem(nid, start, end);
531 } 523 }
532 524
533 return 0; 525 return 0;