diff options
author | Yinghai Lu <yinghai@kernel.org> | 2010-08-25 16:39:18 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-08-27 14:14:37 -0400 |
commit | 774ea0bcb27f57b6fd521b3b6c43237782fed4b9 (patch) | |
tree | 6a488cbf25b12318cb57b76810758115bc888808 | |
parent | 6f2a75369e7561e800d86927ecd83c970996b21f (diff) |
x86: Remove old bootmem code
Requested by Ingo, Thomas and HPA.
The old bootmem code is no longer necessary, and the transition is
complete. Remove it.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | arch/x86/Kconfig | 10 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 56 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 41 | ||||
-rw-r--r-- | arch/x86/mm/memblock.c | 29 | ||||
-rw-r--r-- | arch/x86/mm/numa_32.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 47 |
7 files changed, 1 insertions, 189 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 542bb2610cbb..ce07615f1cde 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -585,15 +585,7 @@ config PARAVIRT_DEBUG | |||
585 | a paravirt_op is missing when it is called. | 585 | a paravirt_op is missing when it is called. |
586 | 586 | ||
587 | config NO_BOOTMEM | 587 | config NO_BOOTMEM |
588 | default y | 588 | def_bool y |
589 | bool "Disable Bootmem code" | ||
590 | ---help--- | ||
591 | Use memblock directly instead of bootmem before slab is ready. | ||
592 | - allocator (buddy) [generic] | ||
593 | - early allocator (bootmem) [generic] | ||
594 | - very early allocator (memblock) [some generic] | ||
595 | - very very early allocator (early brk model) [x86] | ||
596 | So reduce one layer between early allocator to final allocator | ||
597 | 589 | ||
598 | config MEMTEST | 590 | config MEMTEST |
599 | bool "Memtest" | 591 | bool "Memtest" |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 924c8f78e98e..1d114ff6a078 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1014,10 +1014,6 @@ void __init setup_arch(char **cmdline_p) | |||
1014 | 1014 | ||
1015 | initmem_init(0, max_pfn, acpi, k8); | 1015 | initmem_init(0, max_pfn, acpi, k8); |
1016 | memblock_find_dma_reserve(); | 1016 | memblock_find_dma_reserve(); |
1017 | #ifndef CONFIG_NO_BOOTMEM | ||
1018 | memblock_x86_to_bootmem(0, max_low_pfn<<PAGE_SHIFT); | ||
1019 | #endif | ||
1020 | |||
1021 | dma32_reserve_bootmem(); | 1017 | dma32_reserve_bootmem(); |
1022 | 1018 | ||
1023 | #ifdef CONFIG_KVM_CLOCK | 1019 | #ifdef CONFIG_KVM_CLOCK |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 63b09bae2509..c2385d7ae313 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -751,68 +751,12 @@ static void __init zone_sizes_init(void) | |||
751 | free_area_init_nodes(max_zone_pfns); | 751 | free_area_init_nodes(max_zone_pfns); |
752 | } | 752 | } |
753 | 753 | ||
754 | #ifndef CONFIG_NO_BOOTMEM | ||
755 | static unsigned long __init setup_node_bootmem(int nodeid, | ||
756 | unsigned long start_pfn, | ||
757 | unsigned long end_pfn, | ||
758 | unsigned long bootmap) | ||
759 | { | ||
760 | unsigned long bootmap_size; | ||
761 | |||
762 | /* don't touch min_low_pfn */ | ||
763 | bootmap_size = init_bootmem_node(NODE_DATA(nodeid), | ||
764 | bootmap >> PAGE_SHIFT, | ||
765 | start_pfn, end_pfn); | ||
766 | printk(KERN_INFO " node %d low ram: %08lx - %08lx\n", | ||
767 | nodeid, start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT); | ||
768 | printk(KERN_INFO " node %d bootmap %08lx - %08lx\n", | ||
769 | nodeid, bootmap, bootmap + bootmap_size); | ||
770 | free_bootmem_with_active_regions(nodeid, end_pfn); | ||
771 | |||
772 | return bootmap + bootmap_size; | ||
773 | } | ||
774 | #endif | ||
775 | |||
776 | void __init setup_bootmem_allocator(void) | 754 | void __init setup_bootmem_allocator(void) |
777 | { | 755 | { |
778 | #ifndef CONFIG_NO_BOOTMEM | ||
779 | int nodeid; | ||
780 | phys_addr_t bootmap_size, bootmap; | ||
781 | /* | ||
782 | * Initialize the boot-time allocator (with low memory only): | ||
783 | */ | ||
784 | bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT; | ||
785 | bootmap = memblock_find_in_range(0, max_pfn_mapped<<PAGE_SHIFT, bootmap_size, | ||
786 | PAGE_SIZE); | ||
787 | if (bootmap == MEMBLOCK_ERROR) | ||
788 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); | ||
789 | memblock_x86_reserve_range(bootmap, bootmap + bootmap_size, "BOOTMAP"); | ||
790 | #endif | ||
791 | |||
792 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", | 756 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", |
793 | max_pfn_mapped<<PAGE_SHIFT); | 757 | max_pfn_mapped<<PAGE_SHIFT); |
794 | printk(KERN_INFO " low ram: 0 - %08lx\n", max_low_pfn<<PAGE_SHIFT); | 758 | printk(KERN_INFO " low ram: 0 - %08lx\n", max_low_pfn<<PAGE_SHIFT); |
795 | 759 | ||
796 | #ifndef CONFIG_NO_BOOTMEM | ||
797 | for_each_online_node(nodeid) { | ||
798 | unsigned long start_pfn, end_pfn; | ||
799 | |||
800 | #ifdef CONFIG_NEED_MULTIPLE_NODES | ||
801 | start_pfn = node_start_pfn[nodeid]; | ||
802 | end_pfn = node_end_pfn[nodeid]; | ||
803 | if (start_pfn > max_low_pfn) | ||
804 | continue; | ||
805 | if (end_pfn > max_low_pfn) | ||
806 | end_pfn = max_low_pfn; | ||
807 | #else | ||
808 | start_pfn = 0; | ||
809 | end_pfn = max_low_pfn; | ||
810 | #endif | ||
811 | bootmap = setup_node_bootmem(nodeid, start_pfn, end_pfn, | ||
812 | bootmap); | ||
813 | } | ||
814 | #endif | ||
815 | |||
816 | after_bootmem = 1; | 760 | after_bootmem = 1; |
817 | } | 761 | } |
818 | 762 | ||
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index d6d408467c46..690b8d13971d 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -572,23 +572,7 @@ kernel_physical_mapping_init(unsigned long start, | |||
572 | void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, | 572 | void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, |
573 | int acpi, int k8) | 573 | int acpi, int k8) |
574 | { | 574 | { |
575 | #ifndef CONFIG_NO_BOOTMEM | ||
576 | unsigned long bootmap_size, bootmap; | ||
577 | |||
578 | bootmap_size = bootmem_bootmap_pages(end_pfn)<<PAGE_SHIFT; | ||
579 | bootmap = memblock_find_in_range(0, end_pfn<<PAGE_SHIFT, bootmap_size, | ||
580 | PAGE_SIZE); | ||
581 | if (bootmap == MEMBLOCK_ERROR) | ||
582 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); | ||
583 | memblock_x86_reserve_range(bootmap, bootmap + bootmap_size, "BOOTMAP"); | ||
584 | /* don't touch min_low_pfn */ | ||
585 | bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT, | ||
586 | 0, end_pfn); | ||
587 | memblock_x86_register_active_regions(0, start_pfn, end_pfn); | 575 | memblock_x86_register_active_regions(0, start_pfn, end_pfn); |
588 | free_bootmem_with_active_regions(0, end_pfn); | ||
589 | #else | ||
590 | memblock_x86_register_active_regions(0, start_pfn, end_pfn); | ||
591 | #endif | ||
592 | } | 576 | } |
593 | #endif | 577 | #endif |
594 | 578 | ||
@@ -798,31 +782,6 @@ void mark_rodata_ro(void) | |||
798 | 782 | ||
799 | #endif | 783 | #endif |
800 | 784 | ||
801 | #ifndef CONFIG_NO_BOOTMEM | ||
802 | int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, | ||
803 | int flags) | ||
804 | { | ||
805 | unsigned long pfn = phys >> PAGE_SHIFT; | ||
806 | |||
807 | if (pfn >= max_pfn) { | ||
808 | /* | ||
809 | * This can happen with kdump kernels when accessing | ||
810 | * firmware tables: | ||
811 | */ | ||
812 | if (pfn < max_pfn_mapped) | ||
813 | return -EFAULT; | ||
814 | |||
815 | printk(KERN_ERR "reserve_bootmem: illegal reserve %lx %lu\n", | ||
816 | phys, len); | ||
817 | return -EFAULT; | ||
818 | } | ||
819 | |||
820 | reserve_bootmem(phys, len, flags); | ||
821 | |||
822 | return 0; | ||
823 | } | ||
824 | #endif | ||
825 | |||
826 | int kern_addr_valid(unsigned long addr) | 785 | int kern_addr_valid(unsigned long addr) |
827 | { | 786 | { |
828 | unsigned long above = ((long)addr) >> __VIRTUAL_MASK_SHIFT; | 787 | unsigned long above = ((long)addr) >> __VIRTUAL_MASK_SHIFT; |
diff --git a/arch/x86/mm/memblock.c b/arch/x86/mm/memblock.c index aaff3932588e..50ecbc59757f 100644 --- a/arch/x86/mm/memblock.c +++ b/arch/x86/mm/memblock.c | |||
@@ -109,7 +109,6 @@ static __init struct range *find_range_array(int count) | |||
109 | return range; | 109 | return range; |
110 | } | 110 | } |
111 | 111 | ||
112 | #ifdef CONFIG_NO_BOOTMEM | ||
113 | static void __init memblock_x86_subtract_reserved(struct range *range, int az) | 112 | static void __init memblock_x86_subtract_reserved(struct range *range, int az) |
114 | { | 113 | { |
115 | u64 final_start, final_end; | 114 | u64 final_start, final_end; |
@@ -182,34 +181,6 @@ int __init get_free_all_memory_range(struct range **rangep, int nodeid) | |||
182 | *rangep = range; | 181 | *rangep = range; |
183 | return nr_range; | 182 | return nr_range; |
184 | } | 183 | } |
185 | #else | ||
186 | void __init memblock_x86_to_bootmem(u64 start, u64 end) | ||
187 | { | ||
188 | int count; | ||
189 | u64 final_start, final_end; | ||
190 | struct memblock_region *r; | ||
191 | |||
192 | /* Take out region array itself */ | ||
193 | memblock_free_reserved_regions(); | ||
194 | |||
195 | count = memblock.reserved.cnt; | ||
196 | memblock_dbg("(%d early reservations) ==> bootmem [%#010llx-%#010llx]\n", count, start, end - 1); | ||
197 | for_each_memblock(reserved, r) { | ||
198 | memblock_dbg(" [%#010llx-%#010llx] ", (u64)r->base, (u64)r->base + r->size - 1); | ||
199 | final_start = max(start, r->base); | ||
200 | final_end = min(end, r->base + r->size); | ||
201 | if (final_start >= final_end) { | ||
202 | memblock_dbg("\n"); | ||
203 | continue; | ||
204 | } | ||
205 | memblock_dbg(" ==> [%#010llx-%#010llx]\n", final_start, final_end - 1); | ||
206 | reserve_bootmem_generic(final_start, final_end - final_start, BOOTMEM_DEFAULT); | ||
207 | } | ||
208 | |||
209 | /* Put region array back ? */ | ||
210 | memblock_reserve_reserved_regions(); | ||
211 | } | ||
212 | #endif | ||
213 | 184 | ||
214 | static u64 __init __memblock_x86_memory_in_range(u64 addr, u64 limit, bool get_free) | 185 | static u64 __init __memblock_x86_memory_in_range(u64 addr, u64 limit, bool get_free) |
215 | { | 186 | { |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index ddf9730b2061..70ddeb75ba25 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -420,9 +420,6 @@ void __init initmem_init(unsigned long start_pfn, unsigned long end_pfn, | |||
420 | for_each_online_node(nid) { | 420 | for_each_online_node(nid) { |
421 | memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); | 421 | memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); |
422 | NODE_DATA(nid)->node_id = nid; | 422 | NODE_DATA(nid)->node_id = nid; |
423 | #ifndef CONFIG_NO_BOOTMEM | ||
424 | NODE_DATA(nid)->bdata = &bootmem_node_data[nid]; | ||
425 | #endif | ||
426 | } | 423 | } |
427 | 424 | ||
428 | setup_bootmem_allocator(); | 425 | setup_bootmem_allocator(); |
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 984b1ff7db44..aef0ff74f7dd 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -199,10 +199,6 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | |||
199 | unsigned long start_pfn, last_pfn, nodedata_phys; | 199 | unsigned long start_pfn, last_pfn, nodedata_phys; |
200 | const int pgdat_size = roundup(sizeof(pg_data_t), PAGE_SIZE); | 200 | const int pgdat_size = roundup(sizeof(pg_data_t), PAGE_SIZE); |
201 | int nid; | 201 | int nid; |
202 | #ifndef CONFIG_NO_BOOTMEM | ||
203 | unsigned long bootmap_start, bootmap_pages, bootmap_size; | ||
204 | void *bootmap; | ||
205 | #endif | ||
206 | 202 | ||
207 | if (!end) | 203 | if (!end) |
208 | return; | 204 | return; |
@@ -239,47 +235,6 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end) | |||
239 | NODE_DATA(nodeid)->node_start_pfn = start_pfn; | 235 | NODE_DATA(nodeid)->node_start_pfn = start_pfn; |
240 | NODE_DATA(nodeid)->node_spanned_pages = last_pfn - start_pfn; | 236 | NODE_DATA(nodeid)->node_spanned_pages = last_pfn - start_pfn; |
241 | 237 | ||
242 | #ifndef CONFIG_NO_BOOTMEM | ||
243 | NODE_DATA(nodeid)->bdata = &bootmem_node_data[nodeid]; | ||
244 | |||
245 | /* | ||
246 | * Find a place for the bootmem map | ||
247 | * nodedata_phys could be on other nodes by alloc_bootmem, | ||
248 | * so need to sure bootmap_start not to be small, otherwise | ||
249 | * early_node_mem will get that with memblock_find_in_range instead | ||
250 | * of alloc_bootmem, that could clash with reserved range | ||
251 | */ | ||
252 | bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn); | ||
253 | bootmap_start = roundup(nodedata_phys + pgdat_size, PAGE_SIZE); | ||
254 | /* | ||
255 | * SMP_CACHE_BYTES could be enough, but init_bootmem_node like | ||
256 | * to use that to align to PAGE_SIZE | ||
257 | */ | ||
258 | bootmap = early_node_mem(nodeid, bootmap_start, end, | ||
259 | bootmap_pages<<PAGE_SHIFT, PAGE_SIZE); | ||
260 | if (bootmap == NULL) { | ||
261 | memblock_x86_free_range(nodedata_phys, nodedata_phys + pgdat_size); | ||
262 | node_data[nodeid] = NULL; | ||
263 | return; | ||
264 | } | ||
265 | bootmap_start = __pa(bootmap); | ||
266 | memblock_x86_reserve_range(bootmap_start, bootmap_start+(bootmap_pages<<PAGE_SHIFT), | ||
267 | "BOOTMAP"); | ||
268 | |||
269 | bootmap_size = init_bootmem_node(NODE_DATA(nodeid), | ||
270 | bootmap_start >> PAGE_SHIFT, | ||
271 | start_pfn, last_pfn); | ||
272 | |||
273 | printk(KERN_INFO " bootmap [%016lx - %016lx] pages %lx\n", | ||
274 | bootmap_start, bootmap_start + bootmap_size - 1, | ||
275 | bootmap_pages); | ||
276 | nid = phys_to_nid(bootmap_start); | ||
277 | if (nid != nodeid) | ||
278 | printk(KERN_INFO " bootmap(%d) on node %d\n", nodeid, nid); | ||
279 | |||
280 | free_bootmem_with_active_regions(nodeid, end); | ||
281 | #endif | ||
282 | |||
283 | node_set_online(nodeid); | 238 | node_set_online(nodeid); |
284 | } | 239 | } |
285 | 240 | ||
@@ -704,9 +659,7 @@ unsigned long __init numa_free_all_bootmem(void) | |||
704 | for_each_online_node(i) | 659 | for_each_online_node(i) |
705 | pages += free_all_bootmem_node(NODE_DATA(i)); | 660 | pages += free_all_bootmem_node(NODE_DATA(i)); |
706 | 661 | ||
707 | #ifdef CONFIG_NO_BOOTMEM | ||
708 | pages += free_all_memory_core_early(MAX_NUMNODES); | 662 | pages += free_all_memory_core_early(MAX_NUMNODES); |
709 | #endif | ||
710 | 663 | ||
711 | return pages; | 664 | return pages; |
712 | } | 665 | } |