diff options
| -rw-r--r-- | mm/bootmem.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index 459da4710b8f..282b786c2b15 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
| @@ -632,30 +632,15 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, | |||
| 632 | void * __init alloc_bootmem_section(unsigned long size, | 632 | void * __init alloc_bootmem_section(unsigned long size, |
| 633 | unsigned long section_nr) | 633 | unsigned long section_nr) |
| 634 | { | 634 | { |
| 635 | void *ptr; | 635 | bootmem_data_t *bdata; |
| 636 | unsigned long limit, goal, start_nr, end_nr, pfn; | 636 | unsigned long pfn, goal, limit; |
| 637 | struct pglist_data *pgdat; | ||
| 638 | 637 | ||
| 639 | pfn = section_nr_to_pfn(section_nr); | 638 | pfn = section_nr_to_pfn(section_nr); |
| 640 | goal = PFN_PHYS(pfn); | 639 | goal = pfn << PAGE_SHIFT; |
| 641 | limit = PFN_PHYS(section_nr_to_pfn(section_nr + 1)) - 1; | 640 | limit = section_nr_to_pfn(section_nr + 1) << PAGE_SHIFT; |
| 642 | pgdat = NODE_DATA(early_pfn_to_nid(pfn)); | 641 | bdata = &bootmem_node_data[early_pfn_to_nid(pfn)]; |
| 643 | ptr = alloc_bootmem_core(pgdat->bdata, size, SMP_CACHE_BYTES, goal, | ||
| 644 | limit); | ||
| 645 | |||
| 646 | if (!ptr) | ||
| 647 | return NULL; | ||
| 648 | |||
| 649 | start_nr = pfn_to_section_nr(PFN_DOWN(__pa(ptr))); | ||
| 650 | end_nr = pfn_to_section_nr(PFN_DOWN(__pa(ptr) + size)); | ||
| 651 | if (start_nr != section_nr || end_nr != section_nr) { | ||
| 652 | printk(KERN_WARNING "alloc_bootmem failed on section %ld.\n", | ||
| 653 | section_nr); | ||
| 654 | free_bootmem_node(pgdat, __pa(ptr), size); | ||
| 655 | ptr = NULL; | ||
| 656 | } | ||
| 657 | 642 | ||
| 658 | return ptr; | 643 | return alloc_bootmem_core(bdata, size, SMP_CACHE_BYTES, goal, limit); |
| 659 | } | 644 | } |
| 660 | #endif | 645 | #endif |
| 661 | 646 | ||
