Commit f88eff74aa848e58b1ea49768c0bbb874b31357f
Committed by
H. Peter Anvin
1 parent
fb74fb6db9
Exists in
master
and in
20 other branches
bootmem, x86: Add weak version of reserve_bootmem_generic
It will be used memblock_x86_to_bootmem converting It is an wrapper for reserve_bootmem, and x86 64bit is using special one. Also clean up that version for x86_64. We don't need to take care of numa path for that, bootmem can handle it how Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Showing 3 changed files with 8 additions and 24 deletions Side-by-side Diff
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
... | ... | @@ -799,13 +799,10 @@ |
799 | 799 | |
800 | 800 | #endif |
801 | 801 | |
802 | +#ifndef CONFIG_NO_BOOTMEM | |
802 | 803 | int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, |
803 | 804 | int flags) |
804 | 805 | { |
805 | -#ifdef CONFIG_NUMA | |
806 | - int nid, next_nid; | |
807 | - int ret; | |
808 | -#endif | |
809 | 806 | unsigned long pfn = phys >> PAGE_SHIFT; |
810 | 807 | |
811 | 808 | if (pfn >= max_pfn) { |
812 | 809 | |
... | ... | @@ -821,21 +818,7 @@ |
821 | 818 | return -EFAULT; |
822 | 819 | } |
823 | 820 | |
824 | - /* Should check here against the e820 map to avoid double free */ | |
825 | -#ifdef CONFIG_NUMA | |
826 | - nid = phys_to_nid(phys); | |
827 | - next_nid = phys_to_nid(phys + len - 1); | |
828 | - if (nid == next_nid) | |
829 | - ret = reserve_bootmem_node(NODE_DATA(nid), phys, len, flags); | |
830 | - else | |
831 | - ret = reserve_bootmem(phys, len, flags); | |
832 | - | |
833 | - if (ret != 0) | |
834 | - return ret; | |
835 | - | |
836 | -#else | |
837 | 821 | reserve_bootmem(phys, len, flags); |
838 | -#endif | |
839 | 822 | |
840 | 823 | if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { |
841 | 824 | dma_reserve += len / PAGE_SIZE; |
... | ... | @@ -844,6 +827,7 @@ |
844 | 827 | |
845 | 828 | return 0; |
846 | 829 | } |
830 | +#endif | |
847 | 831 | |
848 | 832 | int kern_addr_valid(unsigned long addr) |
849 | 833 | { |
mm/bootmem.c
... | ... | @@ -526,6 +526,12 @@ |
526 | 526 | } |
527 | 527 | |
528 | 528 | #ifndef CONFIG_NO_BOOTMEM |
529 | +int __weak __init reserve_bootmem_generic(unsigned long phys, unsigned long len, | |
530 | + int flags) | |
531 | +{ | |
532 | + return reserve_bootmem(phys, len, flags); | |
533 | +} | |
534 | + | |
529 | 535 | static unsigned long __init align_idx(struct bootmem_data *bdata, |
530 | 536 | unsigned long idx, unsigned long step) |
531 | 537 | { |