aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/include/asm/memblock.h2
-rw-r--r--arch/x86/mm/init_32.c8
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/memblock.c14
-rw-r--r--arch/x86/mm/numa.c15
6 files changed, 13 insertions, 29 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index da349723d411..97f08941dd79 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -25,6 +25,7 @@ config X86
25 select HAVE_IOREMAP_PROT 25 select HAVE_IOREMAP_PROT
26 select HAVE_KPROBES 26 select HAVE_KPROBES
27 select HAVE_MEMBLOCK 27 select HAVE_MEMBLOCK
28 select HAVE_MEMBLOCK_NODE_MAP
28 select ARCH_WANT_OPTIONAL_GPIOLIB 29 select ARCH_WANT_OPTIONAL_GPIOLIB
29 select ARCH_WANT_FRAME_POINTERS 30 select ARCH_WANT_FRAME_POINTERS
30 select HAVE_DMA_ATTRS 31 select HAVE_DMA_ATTRS
diff --git a/arch/x86/include/asm/memblock.h b/arch/x86/include/asm/memblock.h
index 161792ec524f..1460db219a8b 100644
--- a/arch/x86/include/asm/memblock.h
+++ b/arch/x86/include/asm/memblock.h
@@ -12,8 +12,6 @@ int __get_free_all_memory_range(struct range **range, int nodeid,
12 unsigned long start_pfn, unsigned long end_pfn); 12 unsigned long start_pfn, unsigned long end_pfn);
13int get_free_all_memory_range(struct range **rangep, int nodeid); 13int get_free_all_memory_range(struct range **rangep, int nodeid);
14 14
15void memblock_x86_register_active_regions(int nid, unsigned long start_pfn,
16 unsigned long last_pfn);
17u64 memblock_x86_hole_size(u64 start, u64 end); 15u64 memblock_x86_hole_size(u64 start, u64 end);
18u64 memblock_x86_free_memory_in_range(u64 addr, u64 limit); 16u64 memblock_x86_free_memory_in_range(u64 addr, u64 limit);
19u64 memblock_x86_memory_in_range(u64 addr, u64 limit); 17u64 memblock_x86_memory_in_range(u64 addr, u64 limit);
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 29f7c6d98179..5d173db93c4e 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -650,18 +650,18 @@ void __init initmem_init(void)
650 highstart_pfn = highend_pfn = max_pfn; 650 highstart_pfn = highend_pfn = max_pfn;
651 if (max_pfn > max_low_pfn) 651 if (max_pfn > max_low_pfn)
652 highstart_pfn = max_low_pfn; 652 highstart_pfn = max_low_pfn;
653 memblock_x86_register_active_regions(0, 0, highend_pfn);
654 sparse_memory_present_with_active_regions(0);
655 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 653 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
656 pages_to_mb(highend_pfn - highstart_pfn)); 654 pages_to_mb(highend_pfn - highstart_pfn));
657 num_physpages = highend_pfn; 655 num_physpages = highend_pfn;
658 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 656 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
659#else 657#else
660 memblock_x86_register_active_regions(0, 0, max_low_pfn);
661 sparse_memory_present_with_active_regions(0);
662 num_physpages = max_low_pfn; 658 num_physpages = max_low_pfn;
663 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 659 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
664#endif 660#endif
661
662 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
663 sparse_memory_present_with_active_regions(0);
664
665#ifdef CONFIG_FLATMEM 665#ifdef CONFIG_FLATMEM
666 max_mapnr = num_physpages; 666 max_mapnr = num_physpages;
667#endif 667#endif
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index d865c4aeec55..7fb064cbdcec 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -607,7 +607,7 @@ kernel_physical_mapping_init(unsigned long start,
607#ifndef CONFIG_NUMA 607#ifndef CONFIG_NUMA
608void __init initmem_init(void) 608void __init initmem_init(void)
609{ 609{
610 memblock_x86_register_active_regions(0, 0, max_pfn); 610 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
611} 611}
612#endif 612#endif
613 613
diff --git a/arch/x86/mm/memblock.c b/arch/x86/mm/memblock.c
index e4569f85b390..97fbc3973934 100644
--- a/arch/x86/mm/memblock.c
+++ b/arch/x86/mm/memblock.c
@@ -283,20 +283,6 @@ static int __init memblock_x86_find_active_region(const struct memblock_region *
283 return 1; 283 return 1;
284} 284}
285 285
286/* Walk the memblock.memory map and register active regions within a node */
287void __init memblock_x86_register_active_regions(int nid, unsigned long start_pfn,
288 unsigned long last_pfn)
289{
290 unsigned long ei_startpfn;
291 unsigned long ei_endpfn;
292 struct memblock_region *r;
293
294 for_each_memblock(memory, r)
295 if (memblock_x86_find_active_region(r, start_pfn, last_pfn,
296 &ei_startpfn, &ei_endpfn))
297 add_active_range(nid, ei_startpfn, ei_endpfn);
298}
299
300/* 286/*
301 * Find the hole size (in bytes) in the memory range. 287 * Find the hole size (in bytes) in the memory range.
302 * @start: starting address of the memory range to scan 288 * @start: starting address of the memory range to scan
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 824efadc5741..f4a40bdb2e4e 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -498,13 +498,10 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
498 if (WARN_ON(nodes_empty(node_possible_map))) 498 if (WARN_ON(nodes_empty(node_possible_map)))
499 return -EINVAL; 499 return -EINVAL;
500 500
501 for (i = 0; i < mi->nr_blks; i++) 501 for (i = 0; i < mi->nr_blks; i++) {
502 memblock_x86_register_active_regions(mi->blk[i].nid, 502 struct numa_memblk *mb = &mi->blk[i];
503 mi->blk[i].start >> PAGE_SHIFT, 503 memblock_set_node(mb->start, mb->end - mb->start, mb->nid);
504 mi->blk[i].end >> PAGE_SHIFT); 504 }
505
506 /* for out of order entries */
507 sort_node_map();
508 505
509 /* 506 /*
510 * If sections array is gonna be used for pfn -> nid mapping, check 507 * If sections array is gonna be used for pfn -> nid mapping, check
@@ -538,6 +535,8 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
538 setup_node_data(nid, start, end); 535 setup_node_data(nid, start, end);
539 } 536 }
540 537
538 /* Dump memblock with node info and return. */
539 memblock_dump_all();
541 return 0; 540 return 0;
542} 541}
543 542
@@ -575,7 +574,7 @@ static int __init numa_init(int (*init_func)(void))
575 nodes_clear(node_possible_map); 574 nodes_clear(node_possible_map);
576 nodes_clear(node_online_map); 575 nodes_clear(node_online_map);
577 memset(&numa_meminfo, 0, sizeof(numa_meminfo)); 576 memset(&numa_meminfo, 0, sizeof(numa_meminfo));
578 remove_all_active_ranges(); 577 WARN_ON(memblock_set_node(0, ULLONG_MAX, MAX_NUMNODES));
579 numa_reset_distance(); 578 numa_reset_distance();
580 579
581 ret = init_func(); 580 ret = init_func();