diff options
Diffstat (limited to 'mm/bootmem.c')
-rw-r--r-- | mm/bootmem.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index b6791646143e..e8fb927392b9 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -461,6 +461,7 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | |||
461 | 461 | ||
462 | unsigned long __init free_all_bootmem_node(pg_data_t *pgdat) | 462 | unsigned long __init free_all_bootmem_node(pg_data_t *pgdat) |
463 | { | 463 | { |
464 | register_page_bootmem_info_node(pgdat); | ||
464 | return free_all_bootmem_core(pgdat); | 465 | return free_all_bootmem_core(pgdat); |
465 | } | 466 | } |
466 | 467 | ||
@@ -544,6 +545,37 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, | |||
544 | return __alloc_bootmem(size, align, goal); | 545 | return __alloc_bootmem(size, align, goal); |
545 | } | 546 | } |
546 | 547 | ||
548 | #ifdef CONFIG_SPARSEMEM | ||
549 | void * __init alloc_bootmem_section(unsigned long size, | ||
550 | unsigned long section_nr) | ||
551 | { | ||
552 | void *ptr; | ||
553 | unsigned long limit, goal, start_nr, end_nr, pfn; | ||
554 | struct pglist_data *pgdat; | ||
555 | |||
556 | pfn = section_nr_to_pfn(section_nr); | ||
557 | goal = PFN_PHYS(pfn); | ||
558 | limit = PFN_PHYS(section_nr_to_pfn(section_nr + 1)) - 1; | ||
559 | pgdat = NODE_DATA(early_pfn_to_nid(pfn)); | ||
560 | ptr = __alloc_bootmem_core(pgdat->bdata, size, SMP_CACHE_BYTES, goal, | ||
561 | limit); | ||
562 | |||
563 | if (!ptr) | ||
564 | return NULL; | ||
565 | |||
566 | start_nr = pfn_to_section_nr(PFN_DOWN(__pa(ptr))); | ||
567 | end_nr = pfn_to_section_nr(PFN_DOWN(__pa(ptr) + size)); | ||
568 | if (start_nr != section_nr || end_nr != section_nr) { | ||
569 | printk(KERN_WARNING "alloc_bootmem failed on section %ld.\n", | ||
570 | section_nr); | ||
571 | free_bootmem_core(pgdat->bdata, __pa(ptr), size); | ||
572 | ptr = NULL; | ||
573 | } | ||
574 | |||
575 | return ptr; | ||
576 | } | ||
577 | #endif | ||
578 | |||
547 | #ifndef ARCH_LOW_ADDRESS_LIMIT | 579 | #ifndef ARCH_LOW_ADDRESS_LIMIT |
548 | #define ARCH_LOW_ADDRESS_LIMIT 0xffffffffUL | 580 | #define ARCH_LOW_ADDRESS_LIMIT 0xffffffffUL |
549 | #endif | 581 | #endif |