+ mm-memblock-add-memblock-memory-allocation-apis.patch added to -mm tree
[email protected]
maintainerSubject: + mm-memblock-add-memblock-memory-allocation-apis.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 09 Dec 2013 16:29:11 -0800
The patch titled
Subject: mm/memblock: add memblock memory allocation apis
has been added to the -mm tree. Its filename is
mm-memblock-add-memblock-memory-allocation-apis.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-memblock-add-memblock-memory-allocation-apis.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-memblock-add-memblock-memory-allocation-apis.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Santosh Shilimkar <[email protected]>
Subject: mm/memblock: add memblock memory allocation apis
Introduce memblock memory allocation APIs which allow to support PAE or LPAE extension on 32 bits archs where the physical memory start address can be beyond 4GB. In such cases, existing bootmem APIs which operate on 32 bit addresses won't work and needs memblock layer which operates on 64 bit addresses.
So we add equivalent APIs so that we can replace usage of bootmem with memblock interfaces. Architectures already converted to NO_BOOTMEM use these new memblock interfaces. The architectures which are still not converted to NO_BOOTMEM continue to function as is because we still maintain the fal lback option of bootmem back-end supporting these new interfaces. So no functional change as such.
In long run, once all the architectures moves to NO_BOOTMEM, we can get rid of bootmem layer completely. This is one step to remove the core code dependency with bootmem and also gives path for architectures to move away from bootmem.
The proposed interface will became active if both CONFIG_HAVE_MEMBLOCK and CONFIG_NO_BOOTMEM are specified by arch. In case !CONFIG_NO_BOOTMEM, the memblock() wrappers will fallback to the existing bootmem apis so that arch's not converted to NO_BOOTMEM continue to work as is.
The meaning of MEMBLOCK_ALLOC_ACCESSIBLE and MEMBLOCK_ALLOC_ANYWHERE is kept same.
---
include/linux/bootmem.h | 151 ++++++++++++++++++++++++++++ mm/memblock.c | 198 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 349 insertions(+)
include/linux/bootmem.h renamed from include/linux/bootmem.h~mm-memblock-add-memblock-memory-allocation-apis +151 -0
@@ -141,6 +141,157 @@ extern void *__alloc_bootmem_low_node(pg#define alloc_bootmem_low_pages_node (pgdat, x) \ __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) + +#if defined(CONFIG_HAVE_MEMBLOCK ) && defined(CONFIG_NO_BOOTMEM ) + +/* FIXME: use MEMBLOCK_ALLOC_* variants here */ +#define BOOTMEM_ALLOC_ACCESSIBLE 0 +#define BOOTMEM_ALLOC_ANYWHERE (~(phys_addr_t)0) + +/* FIXME: Move to memblock.h at a point where we remove nobootmem.c */ +void *memblock_virt_alloc_try_nid_nopanic (phys_addr_t size, +phys_addr_t align,phys_addr_t min_addr, +phys_addr_t max_addr,int nid); +void *memblock_virt_alloc_try_nid (phys_addr_t size,phys_addr_t align, +phys_addr_t min_addr,phys_addr_t max_addr,int nid); +void __memblock_free_early (phys_addr_t base,phys_addr_t size); +void __memblock_free_late (phys_addr_t base,phys_addr_t size); + +static inline void *__init memblock_virt_alloc ( +phys_addr_t size,phys_addr_t align) +{ +return memblock_virt_alloc_try_nid (size, align,BOOTMEM_LOW_LIMIT , +BOOTMEM_ALLOC_ACCESSIBLE , +NUMA_NO_NODE ); +} + +static inline void *__init memblock_virt_alloc_nopanic ( +phys_addr_t size,phys_addr_t align) +{ +return memblock_virt_alloc_try_nid_nopanic (size, align, +BOOTMEM_LOW_LIMIT , +BOOTMEM_ALLOC_ACCESSIBLE , +NUMA_NO_NODE ); +} + +static inline void *__init memblock_virt_alloc_from_nopanic ( +phys_addr_t size,phys_addr_t align,phys_addr_t min_addr) +{ +return memblock_virt_alloc_try_nid_nopanic (size, align, min_addr, +BOOTMEM_ALLOC_ACCESSIBLE , +NUMA_NO_NODE ); +} + +static inline void *__init memblock_virt_alloc_node ( +phys_addr_t size,int nid) +{ +return memblock_virt_alloc_try_nid (size,0 ,BOOTMEM_LOW_LIMIT , +BOOTMEM_ALLOC_ACCESSIBLE , nid); +} + +static inline void *__init memblock_virt_alloc_node_nopanic ( +phys_addr_t size,int nid) +{ +return memblock_virt_alloc_try_nid_nopanic (size,0 ,BOOTMEM_LOW_LIMIT , +BOOTMEM_ALLOC_ACCESSIBLE , + nid); +} + +static inline void __init memblock_free_early ( +phys_addr_t base,phys_addr_t size) +{ +__memblock_free_early (base, size); +} + +static inline void __init memblock_free_early_nid ( +phys_addr_t base,phys_addr_t size,int nid) +{ +__memblock_free_early (base, size); +} + +static inline void __init memblock_free_late ( +phys_addr_t base,phys_addr_t size) +{ +__memblock_free_late (base, size); +} + +#else + +#define BOOTMEM_ALLOC_ACCESSIBLE 0 + + +/* Fall back to all the existing bootmem APIs */ +static inline void *__init memblock_virt_alloc ( +phys_addr_t size,phys_addr_t align) +{ +if (!align) + align =SMP_CACHE_BYTES ; +return __alloc_bootmem (size, align,BOOTMEM_LOW_LIMIT ); +} + +static inline void *__init memblock_virt_alloc_nopanic ( +phys_addr_t size,phys_addr_t align) +{ +if (!align) + align =SMP_CACHE_BYTES ; +return __alloc_bootmem_nopanic (size, align,BOOTMEM_LOW_LIMIT ); +} + +static inline void *__init memblock_virt_alloc_from_nopanic ( +phys_addr_t size,phys_addr_t align,phys_addr_t min_addr) +{ +return __alloc_bootmem_nopanic (size, align, min_addr); +} + +static inline void *__init memblock_virt_alloc_node ( +phys_addr_t size,int nid) +{ +return __alloc_bootmem_node (NODE_DATA (nid), size,SMP_CACHE_BYTES , +BOOTMEM_LOW_LIMIT ); +} + +static inline void *__init memblock_virt_alloc_node_nopanic ( +phys_addr_t size,int nid) +{ +return __alloc_bootmem_node_nopanic (NODE_DATA (nid), size, +SMP_CACHE_BYTES , +BOOTMEM_LOW_LIMIT ); +} + +static inline void *__init memblock_virt_alloc_try_nid (phys_addr_t size, +phys_addr_t align,phys_addr_t min_addr,phys_addr_t max_addr,int nid) +{ +return __alloc_bootmem_node_high (NODE_DATA (nid), size, align, + min_addr); +} + +static inline void *__init memblock_virt_alloc_try_nid_nopanic ( +phys_addr_t size,phys_addr_t align, +phys_addr_t min_addr,phys_addr_t max_addr,int nid) +{ +return ___alloc_bootmem_node_nopanic (NODE_DATA (nid), size, align, + min_addr, max_addr); +} + +static inline void __init memblock_free_early ( +phys_addr_t base,phys_addr_t size) +{ +free_bootmem (base, size); +} + +static inline void __init memblock_free_early_nid ( +phys_addr_t base,phys_addr_t size,int nid) +{ +free_bootmem_node (NODE_DATA (nid), base, size); +} + +static inline void __init memblock_free_late ( +phys_addr_t base,phys_addr_t size) +{ +free_bootmem_late (base, size); +} +#endif /* defined(CONFIG_HAVE_MEMBLOCK) && defined(CONFIG_NO_BOOTMEM) */ +#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP extern void *alloc_remap (int nid,unsigned long size);#else
mm/memblock.c renamed from mm/memblock.c~mm-memblock-add-memblock-memory-allocation-apis +198 -0
210 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
mm-memblock-debug-correct-displaying-of-upper-memory-boundary.patch mm-memblock-debug-dont-free-reserved-array-if-arch_discard_memblock.patch mm-bootmem-remove-duplicated-declaration-of-__free_pages_bootmem.patch mm-memblock-remove-unnecessary-inclusions-of-bootmemh.patch mm-memblock-drop-warn-and-use-smp_cache_bytes-as-a-default-alignment.patch mm-memblock-reorder-parameters-of-memblock_find_in_range_node.patch mm-memblock-switch-to-use-numa_no_node-instead-of-max_numnodes.patch mm-memblock-add-memblock-memory-allocation-apis.patch mm-memblock-add-memblock-memory-allocation-apis-fix.patch mm-init-use-memblock-apis-for-early-memory-allocations.patch mm-printk-use-memblock-apis-for-early-memory-allocations.patch mm-page_alloc-use-memblock-apis-for-early-memory-allocations.patch mm-power-use-memblock-apis-for-early-memory-allocations.patch lib-swiotlbc-use-memblock-apis-for-early-memory-allocations.patch lib-cpumaskc-use-memblock-apis-for-early-memory-allocations.patch mm-sparse-use-memblock-apis-for-early-memory-allocations.patch mm-hugetlb-use-memblock-apis-for-early-memory-allocations.patch mm-page_cgroup-use-memblock-apis-for-early-memory-allocations.patch mm-percpu-use-memblock-apis-for-early-memory-allocations.patch mm-memory_hotplug-use-memblock-apis-for-early-memory-allocations.patch drivers-firmware-memmapc-use-memblock-apis-for-early-memory-allocations.patch arch-arm-kernel-use-memblock-apis-for-early-memory-allocations.patch arch-arm-mm-initc-use-memblock-apis-for-early-memory-allocations.patch arch-arm-mach-omap2-omap_hwmodc-use-memblock-apis-for-early-memory-allocations.patch linux-next.patch