diff options
author | Yinghai Lu <yinghai@kernel.org> | 2011-02-24 08:43:05 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-02-24 08:43:05 -0500 |
commit | 0932587328d9bd5b500a640fbaff3290c8d4cabf (patch) | |
tree | 7c041a41db88f7bb6d98f2a69e21a33a311b469f /mm/bootmem.c | |
parent | 2bf50555b0920be7e29d3823f6bbd20ee5920489 (diff) |
bootmem: Separate out CONFIG_NO_BOOTMEM code into nobootmem.c
mm/bootmem.c contained code paths for both bootmem and no bootmem
configurations. They implement about the same set of APIs in
different ways and as a result bootmem.c contains massive amount of
#ifdef CONFIG_NO_BOOTMEM.
Separate out CONFIG_NO_BOOTMEM code into mm/nobootmem.c. As the
common part is relatively small, duplicate them in nobootmem.c instead
of creating a common file or ifdef'ing in bootmem.c.
The followings are duplicated.
* {min|max}_low_pfn, max_pfn, saved_max_pfn
* free_bootmem_late()
* ___alloc_bootmem()
* __alloc_bootmem_low()
The followings are applicable only to nobootmem and moved verbatim.
* __free_pages_memory()
* free_all_memory_core_early()
The followings are not applicable to nobootmem and omitted in
nobootmem.c.
* reserve_bootmem_node()
* reserve_bootmem()
The rest split function bodies according to CONFIG_NO_BOOTMEM.
Makefile is updated so that only either bootmem.c or nobootmem.c is
built according to CONFIG_NO_BOOTMEM.
This patch doesn't introduce any behavior change.
-tj: Rewrote commit description.
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'mm/bootmem.c')
-rw-r--r-- | mm/bootmem.c | 173 |
1 files changed, 3 insertions, 170 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index 13b0caa9793c..4403e2fbc13d 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -35,7 +35,6 @@ unsigned long max_pfn; | |||
35 | unsigned long saved_max_pfn; | 35 | unsigned long saved_max_pfn; |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #ifndef CONFIG_NO_BOOTMEM | ||
39 | bootmem_data_t bootmem_node_data[MAX_NUMNODES] __initdata; | 38 | bootmem_data_t bootmem_node_data[MAX_NUMNODES] __initdata; |
40 | 39 | ||
41 | static struct list_head bdata_list __initdata = LIST_HEAD_INIT(bdata_list); | 40 | static struct list_head bdata_list __initdata = LIST_HEAD_INIT(bdata_list); |
@@ -146,7 +145,7 @@ unsigned long __init init_bootmem(unsigned long start, unsigned long pages) | |||
146 | min_low_pfn = start; | 145 | min_low_pfn = start; |
147 | return init_bootmem_core(NODE_DATA(0)->bdata, start, 0, pages); | 146 | return init_bootmem_core(NODE_DATA(0)->bdata, start, 0, pages); |
148 | } | 147 | } |
149 | #endif | 148 | |
150 | /* | 149 | /* |
151 | * free_bootmem_late - free bootmem pages directly to page allocator | 150 | * free_bootmem_late - free bootmem pages directly to page allocator |
152 | * @addr: starting address of the range | 151 | * @addr: starting address of the range |
@@ -171,53 +170,6 @@ void __init free_bootmem_late(unsigned long addr, unsigned long size) | |||
171 | } | 170 | } |
172 | } | 171 | } |
173 | 172 | ||
174 | #ifdef CONFIG_NO_BOOTMEM | ||
175 | static void __init __free_pages_memory(unsigned long start, unsigned long end) | ||
176 | { | ||
177 | int i; | ||
178 | unsigned long start_aligned, end_aligned; | ||
179 | int order = ilog2(BITS_PER_LONG); | ||
180 | |||
181 | start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1); | ||
182 | end_aligned = end & ~(BITS_PER_LONG - 1); | ||
183 | |||
184 | if (end_aligned <= start_aligned) { | ||
185 | for (i = start; i < end; i++) | ||
186 | __free_pages_bootmem(pfn_to_page(i), 0); | ||
187 | |||
188 | return; | ||
189 | } | ||
190 | |||
191 | for (i = start; i < start_aligned; i++) | ||
192 | __free_pages_bootmem(pfn_to_page(i), 0); | ||
193 | |||
194 | for (i = start_aligned; i < end_aligned; i += BITS_PER_LONG) | ||
195 | __free_pages_bootmem(pfn_to_page(i), order); | ||
196 | |||
197 | for (i = end_aligned; i < end; i++) | ||
198 | __free_pages_bootmem(pfn_to_page(i), 0); | ||
199 | } | ||
200 | |||
201 | unsigned long __init free_all_memory_core_early(int nodeid) | ||
202 | { | ||
203 | int i; | ||
204 | u64 start, end; | ||
205 | unsigned long count = 0; | ||
206 | struct range *range = NULL; | ||
207 | int nr_range; | ||
208 | |||
209 | nr_range = get_free_all_memory_range(&range, nodeid); | ||
210 | |||
211 | for (i = 0; i < nr_range; i++) { | ||
212 | start = range[i].start; | ||
213 | end = range[i].end; | ||
214 | count += end - start; | ||
215 | __free_pages_memory(start, end); | ||
216 | } | ||
217 | |||
218 | return count; | ||
219 | } | ||
220 | #else | ||
221 | static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) | 173 | static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) |
222 | { | 174 | { |
223 | int aligned; | 175 | int aligned; |
@@ -278,7 +230,6 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) | |||
278 | 230 | ||
279 | return count; | 231 | return count; |
280 | } | 232 | } |
281 | #endif | ||
282 | 233 | ||
283 | /** | 234 | /** |
284 | * free_all_bootmem_node - release a node's free pages to the buddy allocator | 235 | * free_all_bootmem_node - release a node's free pages to the buddy allocator |
@@ -289,12 +240,7 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) | |||
289 | unsigned long __init free_all_bootmem_node(pg_data_t *pgdat) | 240 | unsigned long __init free_all_bootmem_node(pg_data_t *pgdat) |
290 | { | 241 | { |
291 | register_page_bootmem_info_node(pgdat); | 242 | register_page_bootmem_info_node(pgdat); |
292 | #ifdef CONFIG_NO_BOOTMEM | ||
293 | /* free_all_memory_core_early(MAX_NUMNODES) will be called later */ | ||
294 | return 0; | ||
295 | #else | ||
296 | return free_all_bootmem_core(pgdat->bdata); | 243 | return free_all_bootmem_core(pgdat->bdata); |
297 | #endif | ||
298 | } | 244 | } |
299 | 245 | ||
300 | /** | 246 | /** |
@@ -304,16 +250,6 @@ unsigned long __init free_all_bootmem_node(pg_data_t *pgdat) | |||
304 | */ | 250 | */ |
305 | unsigned long __init free_all_bootmem(void) | 251 | unsigned long __init free_all_bootmem(void) |
306 | { | 252 | { |
307 | #ifdef CONFIG_NO_BOOTMEM | ||
308 | /* | ||
309 | * We need to use MAX_NUMNODES instead of NODE_DATA(0)->node_id | ||
310 | * because in some case like Node0 doesnt have RAM installed | ||
311 | * low ram will be on Node1 | ||
312 | * Use MAX_NUMNODES will make sure all ranges in early_node_map[] | ||
313 | * will be used instead of only Node0 related | ||
314 | */ | ||
315 | return free_all_memory_core_early(MAX_NUMNODES); | ||
316 | #else | ||
317 | unsigned long total_pages = 0; | 253 | unsigned long total_pages = 0; |
318 | bootmem_data_t *bdata; | 254 | bootmem_data_t *bdata; |
319 | 255 | ||
@@ -321,10 +257,8 @@ unsigned long __init free_all_bootmem(void) | |||
321 | total_pages += free_all_bootmem_core(bdata); | 257 | total_pages += free_all_bootmem_core(bdata); |
322 | 258 | ||
323 | return total_pages; | 259 | return total_pages; |
324 | #endif | ||
325 | } | 260 | } |
326 | 261 | ||
327 | #ifndef CONFIG_NO_BOOTMEM | ||
328 | static void __init __free(bootmem_data_t *bdata, | 262 | static void __init __free(bootmem_data_t *bdata, |
329 | unsigned long sidx, unsigned long eidx) | 263 | unsigned long sidx, unsigned long eidx) |
330 | { | 264 | { |
@@ -419,7 +353,6 @@ static int __init mark_bootmem(unsigned long start, unsigned long end, | |||
419 | } | 353 | } |
420 | BUG(); | 354 | BUG(); |
421 | } | 355 | } |
422 | #endif | ||
423 | 356 | ||
424 | /** | 357 | /** |
425 | * free_bootmem_node - mark a page range as usable | 358 | * free_bootmem_node - mark a page range as usable |
@@ -434,10 +367,6 @@ static int __init mark_bootmem(unsigned long start, unsigned long end, | |||
434 | void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | 367 | void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, |
435 | unsigned long size) | 368 | unsigned long size) |
436 | { | 369 | { |
437 | #ifdef CONFIG_NO_BOOTMEM | ||
438 | kmemleak_free_part(__va(physaddr), size); | ||
439 | memblock_x86_free_range(physaddr, physaddr + size); | ||
440 | #else | ||
441 | unsigned long start, end; | 370 | unsigned long start, end; |
442 | 371 | ||
443 | kmemleak_free_part(__va(physaddr), size); | 372 | kmemleak_free_part(__va(physaddr), size); |
@@ -446,7 +375,6 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | |||
446 | end = PFN_DOWN(physaddr + size); | 375 | end = PFN_DOWN(physaddr + size); |
447 | 376 | ||
448 | mark_bootmem_node(pgdat->bdata, start, end, 0, 0); | 377 | mark_bootmem_node(pgdat->bdata, start, end, 0, 0); |
449 | #endif | ||
450 | } | 378 | } |
451 | 379 | ||
452 | /** | 380 | /** |
@@ -460,10 +388,6 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | |||
460 | */ | 388 | */ |
461 | void __init free_bootmem(unsigned long addr, unsigned long size) | 389 | void __init free_bootmem(unsigned long addr, unsigned long size) |
462 | { | 390 | { |
463 | #ifdef CONFIG_NO_BOOTMEM | ||
464 | kmemleak_free_part(__va(addr), size); | ||
465 | memblock_x86_free_range(addr, addr + size); | ||
466 | #else | ||
467 | unsigned long start, end; | 391 | unsigned long start, end; |
468 | 392 | ||
469 | kmemleak_free_part(__va(addr), size); | 393 | kmemleak_free_part(__va(addr), size); |
@@ -472,7 +396,6 @@ void __init free_bootmem(unsigned long addr, unsigned long size) | |||
472 | end = PFN_DOWN(addr + size); | 396 | end = PFN_DOWN(addr + size); |
473 | 397 | ||
474 | mark_bootmem(start, end, 0, 0); | 398 | mark_bootmem(start, end, 0, 0); |
475 | #endif | ||
476 | } | 399 | } |
477 | 400 | ||
478 | /** | 401 | /** |
@@ -489,17 +412,12 @@ void __init free_bootmem(unsigned long addr, unsigned long size) | |||
489 | int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | 412 | int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, |
490 | unsigned long size, int flags) | 413 | unsigned long size, int flags) |
491 | { | 414 | { |
492 | #ifdef CONFIG_NO_BOOTMEM | ||
493 | panic("no bootmem"); | ||
494 | return 0; | ||
495 | #else | ||
496 | unsigned long start, end; | 415 | unsigned long start, end; |
497 | 416 | ||
498 | start = PFN_DOWN(physaddr); | 417 | start = PFN_DOWN(physaddr); |
499 | end = PFN_UP(physaddr + size); | 418 | end = PFN_UP(physaddr + size); |
500 | 419 | ||
501 | return mark_bootmem_node(pgdat->bdata, start, end, 1, flags); | 420 | return mark_bootmem_node(pgdat->bdata, start, end, 1, flags); |
502 | #endif | ||
503 | } | 421 | } |
504 | 422 | ||
505 | /** | 423 | /** |
@@ -515,20 +433,14 @@ int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | |||
515 | int __init reserve_bootmem(unsigned long addr, unsigned long size, | 433 | int __init reserve_bootmem(unsigned long addr, unsigned long size, |
516 | int flags) | 434 | int flags) |
517 | { | 435 | { |
518 | #ifdef CONFIG_NO_BOOTMEM | ||
519 | panic("no bootmem"); | ||
520 | return 0; | ||
521 | #else | ||
522 | unsigned long start, end; | 436 | unsigned long start, end; |
523 | 437 | ||
524 | start = PFN_DOWN(addr); | 438 | start = PFN_DOWN(addr); |
525 | end = PFN_UP(addr + size); | 439 | end = PFN_UP(addr + size); |
526 | 440 | ||
527 | return mark_bootmem(start, end, 1, flags); | 441 | return mark_bootmem(start, end, 1, flags); |
528 | #endif | ||
529 | } | 442 | } |
530 | 443 | ||
531 | #ifndef CONFIG_NO_BOOTMEM | ||
532 | int __weak __init reserve_bootmem_generic(unsigned long phys, unsigned long len, | 444 | int __weak __init reserve_bootmem_generic(unsigned long phys, unsigned long len, |
533 | int flags) | 445 | int flags) |
534 | { | 446 | { |
@@ -685,33 +597,12 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, | |||
685 | #endif | 597 | #endif |
686 | return NULL; | 598 | return NULL; |
687 | } | 599 | } |
688 | #endif | ||
689 | 600 | ||
690 | static void * __init ___alloc_bootmem_nopanic(unsigned long size, | 601 | static void * __init ___alloc_bootmem_nopanic(unsigned long size, |
691 | unsigned long align, | 602 | unsigned long align, |
692 | unsigned long goal, | 603 | unsigned long goal, |
693 | unsigned long limit) | 604 | unsigned long limit) |
694 | { | 605 | { |
695 | #ifdef CONFIG_NO_BOOTMEM | ||
696 | void *ptr; | ||
697 | |||
698 | if (WARN_ON_ONCE(slab_is_available())) | ||
699 | return kzalloc(size, GFP_NOWAIT); | ||
700 | |||
701 | restart: | ||
702 | |||
703 | ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, goal, limit); | ||
704 | |||
705 | if (ptr) | ||
706 | return ptr; | ||
707 | |||
708 | if (goal != 0) { | ||
709 | goal = 0; | ||
710 | goto restart; | ||
711 | } | ||
712 | |||
713 | return NULL; | ||
714 | #else | ||
715 | bootmem_data_t *bdata; | 606 | bootmem_data_t *bdata; |
716 | void *region; | 607 | void *region; |
717 | 608 | ||
@@ -737,7 +628,6 @@ restart: | |||
737 | } | 628 | } |
738 | 629 | ||
739 | return NULL; | 630 | return NULL; |
740 | #endif | ||
741 | } | 631 | } |
742 | 632 | ||
743 | /** | 633 | /** |
@@ -758,10 +648,6 @@ void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align, | |||
758 | { | 648 | { |
759 | unsigned long limit = 0; | 649 | unsigned long limit = 0; |
760 | 650 | ||
761 | #ifdef CONFIG_NO_BOOTMEM | ||
762 | limit = -1UL; | ||
763 | #endif | ||
764 | |||
765 | return ___alloc_bootmem_nopanic(size, align, goal, limit); | 651 | return ___alloc_bootmem_nopanic(size, align, goal, limit); |
766 | } | 652 | } |
767 | 653 | ||
@@ -798,14 +684,9 @@ void * __init __alloc_bootmem(unsigned long size, unsigned long align, | |||
798 | { | 684 | { |
799 | unsigned long limit = 0; | 685 | unsigned long limit = 0; |
800 | 686 | ||
801 | #ifdef CONFIG_NO_BOOTMEM | ||
802 | limit = -1UL; | ||
803 | #endif | ||
804 | |||
805 | return ___alloc_bootmem(size, align, goal, limit); | 687 | return ___alloc_bootmem(size, align, goal, limit); |
806 | } | 688 | } |
807 | 689 | ||
808 | #ifndef CONFIG_NO_BOOTMEM | ||
809 | static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, | 690 | static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, |
810 | unsigned long size, unsigned long align, | 691 | unsigned long size, unsigned long align, |
811 | unsigned long goal, unsigned long limit) | 692 | unsigned long goal, unsigned long limit) |
@@ -822,7 +703,6 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, | |||
822 | 703 | ||
823 | return ___alloc_bootmem(size, align, goal, limit); | 704 | return ___alloc_bootmem(size, align, goal, limit); |
824 | } | 705 | } |
825 | #endif | ||
826 | 706 | ||
827 | /** | 707 | /** |
828 | * __alloc_bootmem_node - allocate boot memory from a specific node | 708 | * __alloc_bootmem_node - allocate boot memory from a specific node |
@@ -842,24 +722,10 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, | |||
842 | void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, | 722 | void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, |
843 | unsigned long align, unsigned long goal) | 723 | unsigned long align, unsigned long goal) |
844 | { | 724 | { |
845 | void *ptr; | ||
846 | |||
847 | if (WARN_ON_ONCE(slab_is_available())) | 725 | if (WARN_ON_ONCE(slab_is_available())) |
848 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); | 726 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); |
849 | 727 | ||
850 | #ifdef CONFIG_NO_BOOTMEM | 728 | return ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); |
851 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, | ||
852 | goal, -1ULL); | ||
853 | if (ptr) | ||
854 | return ptr; | ||
855 | |||
856 | ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, | ||
857 | goal, -1ULL); | ||
858 | #else | ||
859 | ptr = ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); | ||
860 | #endif | ||
861 | |||
862 | return ptr; | ||
863 | } | 729 | } |
864 | 730 | ||
865 | void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, | 731 | void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, |
@@ -880,13 +746,8 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, | |||
880 | unsigned long new_goal; | 746 | unsigned long new_goal; |
881 | 747 | ||
882 | new_goal = MAX_DMA32_PFN << PAGE_SHIFT; | 748 | new_goal = MAX_DMA32_PFN << PAGE_SHIFT; |
883 | #ifdef CONFIG_NO_BOOTMEM | ||
884 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, | ||
885 | new_goal, -1ULL); | ||
886 | #else | ||
887 | ptr = alloc_bootmem_core(pgdat->bdata, size, align, | 749 | ptr = alloc_bootmem_core(pgdat->bdata, size, align, |
888 | new_goal, 0); | 750 | new_goal, 0); |
889 | #endif | ||
890 | if (ptr) | 751 | if (ptr) |
891 | return ptr; | 752 | return ptr; |
892 | } | 753 | } |
@@ -907,16 +768,6 @@ void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, | |||
907 | void * __init alloc_bootmem_section(unsigned long size, | 768 | void * __init alloc_bootmem_section(unsigned long size, |
908 | unsigned long section_nr) | 769 | unsigned long section_nr) |
909 | { | 770 | { |
910 | #ifdef CONFIG_NO_BOOTMEM | ||
911 | unsigned long pfn, goal, limit; | ||
912 | |||
913 | pfn = section_nr_to_pfn(section_nr); | ||
914 | goal = pfn << PAGE_SHIFT; | ||
915 | limit = section_nr_to_pfn(section_nr + 1) << PAGE_SHIFT; | ||
916 | |||
917 | return __alloc_memory_core_early(early_pfn_to_nid(pfn), size, | ||
918 | SMP_CACHE_BYTES, goal, limit); | ||
919 | #else | ||
920 | bootmem_data_t *bdata; | 771 | bootmem_data_t *bdata; |
921 | unsigned long pfn, goal, limit; | 772 | unsigned long pfn, goal, limit; |
922 | 773 | ||
@@ -926,7 +777,6 @@ void * __init alloc_bootmem_section(unsigned long size, | |||
926 | bdata = &bootmem_node_data[early_pfn_to_nid(pfn)]; | 777 | bdata = &bootmem_node_data[early_pfn_to_nid(pfn)]; |
927 | 778 | ||
928 | return alloc_bootmem_core(bdata, size, SMP_CACHE_BYTES, goal, limit); | 779 | return alloc_bootmem_core(bdata, size, SMP_CACHE_BYTES, goal, limit); |
929 | #endif | ||
930 | } | 780 | } |
931 | #endif | 781 | #endif |
932 | 782 | ||
@@ -938,16 +788,11 @@ void * __init __alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size, | |||
938 | if (WARN_ON_ONCE(slab_is_available())) | 788 | if (WARN_ON_ONCE(slab_is_available())) |
939 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); | 789 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); |
940 | 790 | ||
941 | #ifdef CONFIG_NO_BOOTMEM | ||
942 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, | ||
943 | goal, -1ULL); | ||
944 | #else | ||
945 | ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size, align, goal, 0); | 791 | ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size, align, goal, 0); |
946 | if (ptr) | 792 | if (ptr) |
947 | return ptr; | 793 | return ptr; |
948 | 794 | ||
949 | ptr = alloc_bootmem_core(pgdat->bdata, size, align, goal, 0); | 795 | ptr = alloc_bootmem_core(pgdat->bdata, size, align, goal, 0); |
950 | #endif | ||
951 | if (ptr) | 796 | if (ptr) |
952 | return ptr; | 797 | return ptr; |
953 | 798 | ||
@@ -995,21 +840,9 @@ void * __init __alloc_bootmem_low(unsigned long size, unsigned long align, | |||
995 | void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, | 840 | void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, |
996 | unsigned long align, unsigned long goal) | 841 | unsigned long align, unsigned long goal) |
997 | { | 842 | { |
998 | void *ptr; | ||
999 | |||
1000 | if (WARN_ON_ONCE(slab_is_available())) | 843 | if (WARN_ON_ONCE(slab_is_available())) |
1001 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); | 844 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); |
1002 | 845 | ||
1003 | #ifdef CONFIG_NO_BOOTMEM | 846 | return ___alloc_bootmem_node(pgdat->bdata, size, align, |
1004 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, | ||
1005 | goal, ARCH_LOW_ADDRESS_LIMIT); | 847 | goal, ARCH_LOW_ADDRESS_LIMIT); |
1006 | if (ptr) | ||
1007 | return ptr; | ||
1008 | ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, | ||
1009 | goal, ARCH_LOW_ADDRESS_LIMIT); | ||
1010 | #else | ||
1011 | ptr = ___alloc_bootmem_node(pgdat->bdata, size, align, | ||
1012 | goal, ARCH_LOW_ADDRESS_LIMIT); | ||
1013 | #endif | ||
1014 | return ptr; | ||
1015 | } | 848 | } |