diff options
-rw-r--r-- | arch/x86/include/asm/memblock.h | 1 | ||||
-rw-r--r-- | arch/x86/mm/memblock.c | 15 | ||||
-rw-r--r-- | arch/x86/mm/numa.c | 9 | ||||
-rw-r--r-- | include/linux/mm.h | 2 | ||||
-rw-r--r-- | mm/nobootmem.c | 3 | ||||
-rw-r--r-- | mm/page_alloc.c | 67 |
6 files changed, 2 insertions, 95 deletions
diff --git a/arch/x86/include/asm/memblock.h b/arch/x86/include/asm/memblock.h index 0cd3800f33b9..161792ec524f 100644 --- a/arch/x86/include/asm/memblock.h +++ b/arch/x86/include/asm/memblock.h | |||
@@ -15,7 +15,6 @@ int get_free_all_memory_range(struct range **rangep, int nodeid); | |||
15 | void memblock_x86_register_active_regions(int nid, unsigned long start_pfn, | 15 | void memblock_x86_register_active_regions(int nid, unsigned long start_pfn, |
16 | unsigned long last_pfn); | 16 | unsigned long last_pfn); |
17 | u64 memblock_x86_hole_size(u64 start, u64 end); | 17 | u64 memblock_x86_hole_size(u64 start, u64 end); |
18 | u64 memblock_x86_find_in_range_node(int nid, u64 start, u64 end, u64 size, u64 align); | ||
19 | u64 memblock_x86_free_memory_in_range(u64 addr, u64 limit); | 18 | u64 memblock_x86_free_memory_in_range(u64 addr, u64 limit); |
20 | u64 memblock_x86_memory_in_range(u64 addr, u64 limit); | 19 | u64 memblock_x86_memory_in_range(u64 addr, u64 limit); |
21 | bool memblock_x86_check_reserved_size(u64 *addrp, u64 *sizep, u64 align); | 20 | bool memblock_x86_check_reserved_size(u64 *addrp, u64 *sizep, u64 align); |
diff --git a/arch/x86/mm/memblock.c b/arch/x86/mm/memblock.c index da0d5c84586e..e4569f85b390 100644 --- a/arch/x86/mm/memblock.c +++ b/arch/x86/mm/memblock.c | |||
@@ -252,21 +252,6 @@ void __init memblock_x86_free_range(u64 start, u64 end) | |||
252 | } | 252 | } |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * Need to call this function after memblock_x86_register_active_regions, | ||
256 | * so early_node_map[] is filled already. | ||
257 | */ | ||
258 | u64 __init memblock_x86_find_in_range_node(int nid, u64 start, u64 end, u64 size, u64 align) | ||
259 | { | ||
260 | u64 addr; | ||
261 | addr = find_memory_core_early(nid, size, align, start, end); | ||
262 | if (addr) | ||
263 | return addr; | ||
264 | |||
265 | /* Fallback, should already have start end within node range */ | ||
266 | return memblock_find_in_range(start, end, size, align); | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * Finds an active region in the address range from start_pfn to last_pfn and | 255 | * Finds an active region in the address range from start_pfn to last_pfn and |
271 | * returns its range in ei_startpfn and ei_endpfn for the memblock entry. | 256 | * returns its range in ei_startpfn and ei_endpfn for the memblock entry. |
272 | */ | 257 | */ |
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index fa1015de5cc0..824efadc5741 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
@@ -192,8 +192,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end) | |||
192 | /* Initialize NODE_DATA for a node on the local memory */ | 192 | /* Initialize NODE_DATA for a node on the local memory */ |
193 | static void __init setup_node_data(int nid, u64 start, u64 end) | 193 | static void __init setup_node_data(int nid, u64 start, u64 end) |
194 | { | 194 | { |
195 | const u64 nd_low = PFN_PHYS(MAX_DMA_PFN); | ||
196 | const u64 nd_high = PFN_PHYS(max_pfn_mapped); | ||
197 | const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); | 195 | const size_t nd_size = roundup(sizeof(pg_data_t), PAGE_SIZE); |
198 | bool remapped = false; | 196 | bool remapped = false; |
199 | u64 nd_pa; | 197 | u64 nd_pa; |
@@ -224,17 +222,12 @@ static void __init setup_node_data(int nid, u64 start, u64 end) | |||
224 | nd_pa = __pa(nd); | 222 | nd_pa = __pa(nd); |
225 | remapped = true; | 223 | remapped = true; |
226 | } else { | 224 | } else { |
227 | nd_pa = memblock_x86_find_in_range_node(nid, nd_low, nd_high, | 225 | nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid); |
228 | nd_size, SMP_CACHE_BYTES); | ||
229 | if (!nd_pa) | ||
230 | nd_pa = memblock_find_in_range(nd_low, nd_high, | ||
231 | nd_size, SMP_CACHE_BYTES); | ||
232 | if (!nd_pa) { | 226 | if (!nd_pa) { |
233 | pr_err("Cannot find %zu bytes in node %d\n", | 227 | pr_err("Cannot find %zu bytes in node %d\n", |
234 | nd_size, nid); | 228 | nd_size, nid); |
235 | return; | 229 | return; |
236 | } | 230 | } |
237 | memblock_x86_reserve_range(nd_pa, nd_pa + nd_size, "NODE_DATA"); | ||
238 | nd = __va(nd_pa); | 231 | nd = __va(nd_pa); |
239 | } | 232 | } |
240 | 233 | ||
diff --git a/include/linux/mm.h b/include/linux/mm.h index 57e4c9ffdff8..9ebc65ae6863 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1325,8 +1325,6 @@ extern void free_bootmem_with_active_regions(int nid, | |||
1325 | unsigned long max_low_pfn); | 1325 | unsigned long max_low_pfn); |
1326 | int add_from_early_node_map(struct range *range, int az, | 1326 | int add_from_early_node_map(struct range *range, int az, |
1327 | int nr_range, int nid); | 1327 | int nr_range, int nid); |
1328 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, | ||
1329 | u64 goal, u64 limit); | ||
1330 | extern void sparse_memory_present_with_active_regions(int nid); | 1328 | extern void sparse_memory_present_with_active_regions(int nid); |
1331 | 1329 | ||
1332 | extern void __next_mem_pfn_range(int *idx, int nid, | 1330 | extern void __next_mem_pfn_range(int *idx, int nid, |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 5b0eb06ecb4e..c78162668bc4 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -41,8 +41,7 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align, | |||
41 | if (limit > memblock.current_limit) | 41 | if (limit > memblock.current_limit) |
42 | limit = memblock.current_limit; | 42 | limit = memblock.current_limit; |
43 | 43 | ||
44 | addr = find_memory_core_early(nid, size, align, goal, limit); | 44 | addr = memblock_find_in_range_node(goal, limit, size, align, nid); |
45 | |||
46 | if (!addr) | 45 | if (!addr) |
47 | return NULL; | 46 | return NULL; |
48 | 47 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 902f03a4fd6b..8ab5e5e7fdad 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3779,73 +3779,6 @@ void __init free_bootmem_with_active_regions(int nid, unsigned long max_low_pfn) | |||
3779 | } | 3779 | } |
3780 | } | 3780 | } |
3781 | 3781 | ||
3782 | #ifdef CONFIG_HAVE_MEMBLOCK | ||
3783 | /* | ||
3784 | * Basic iterator support. Return the last range of PFNs for a node | ||
3785 | * Note: nid == MAX_NUMNODES returns last region regardless of node | ||
3786 | */ | ||
3787 | static int __meminit last_active_region_index_in_nid(int nid) | ||
3788 | { | ||
3789 | int i; | ||
3790 | |||
3791 | for (i = nr_nodemap_entries - 1; i >= 0; i--) | ||
3792 | if (nid == MAX_NUMNODES || early_node_map[i].nid == nid) | ||
3793 | return i; | ||
3794 | |||
3795 | return -1; | ||
3796 | } | ||
3797 | |||
3798 | /* | ||
3799 | * Basic iterator support. Return the previous active range of PFNs for a node | ||
3800 | * Note: nid == MAX_NUMNODES returns next region regardless of node | ||
3801 | */ | ||
3802 | static int __meminit previous_active_region_index_in_nid(int index, int nid) | ||
3803 | { | ||
3804 | for (index = index - 1; index >= 0; index--) | ||
3805 | if (nid == MAX_NUMNODES || early_node_map[index].nid == nid) | ||
3806 | return index; | ||
3807 | |||
3808 | return -1; | ||
3809 | } | ||
3810 | |||
3811 | #define for_each_active_range_index_in_nid_reverse(i, nid) \ | ||
3812 | for (i = last_active_region_index_in_nid(nid); i != -1; \ | ||
3813 | i = previous_active_region_index_in_nid(i, nid)) | ||
3814 | |||
3815 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, | ||
3816 | u64 goal, u64 limit) | ||
3817 | { | ||
3818 | int i; | ||
3819 | |||
3820 | /* Need to go over early_node_map to find out good range for node */ | ||
3821 | for_each_active_range_index_in_nid_reverse(i, nid) { | ||
3822 | u64 addr; | ||
3823 | u64 ei_start, ei_last; | ||
3824 | u64 final_start, final_end; | ||
3825 | |||
3826 | ei_last = early_node_map[i].end_pfn; | ||
3827 | ei_last <<= PAGE_SHIFT; | ||
3828 | ei_start = early_node_map[i].start_pfn; | ||
3829 | ei_start <<= PAGE_SHIFT; | ||
3830 | |||
3831 | final_start = max(ei_start, goal); | ||
3832 | final_end = min(ei_last, limit); | ||
3833 | |||
3834 | if (final_start >= final_end) | ||
3835 | continue; | ||
3836 | |||
3837 | addr = memblock_find_in_range(final_start, final_end, size, align); | ||
3838 | |||
3839 | if (!addr) | ||
3840 | continue; | ||
3841 | |||
3842 | return addr; | ||
3843 | } | ||
3844 | |||
3845 | return 0; | ||
3846 | } | ||
3847 | #endif | ||
3848 | |||
3849 | int __init add_from_early_node_map(struct range *range, int az, | 3782 | int __init add_from_early_node_map(struct range *range, int az, |
3850 | int nr_range, int nid) | 3783 | int nr_range, int nid) |
3851 | { | 3784 | { |