The patch titled Subject: memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc has been added to the -mm tree. Its filename is memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc.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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxx> Subject: memblock: replace memblock_alloc_base(ANYWHERE) with memblock_phys_alloc The calls to memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE) and memblock_phys_alloc(size, align) are equivalent as both try to allocate 'size' bytes with 'align' alignment anywhere in the memory and panic if hte allocation fails. The conversion is done using the following semantic patch: @@ expression size, align; @@ - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE) + memblock_phys_alloc(size, align) Link: http://lkml.kernel.org/r/1548057848-15136-4-git-send-email-rppt@xxxxxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Dennis Zhou <dennis@xxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: Greentime Hu <green.hu@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Guan Xuetao <gxt@xxxxxxxxxx> Cc: Guo Ren <guoren@xxxxxxxxxx> Cc: Guo Ren <ren_guo@xxxxxxxxx> [c-sky] Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: Juergen Gross <jgross@xxxxxxxx> [Xen] Cc: Mark Salter <msalter@xxxxxxxxxx> Cc: Matt Turner <mattst88@xxxxxxxxx> Cc: Max Filippov <jcmvbkbc@xxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Michal Simek <monstr@xxxxxxxxx> Cc: Paul Burton <paul.burton@xxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Richard Weinberger <richard@xxxxxx> Cc: Rich Felker <dalias@xxxxxxxx> Cc: Rob Herring <robh+dt@xxxxxxxxxx> Cc: Rob Herring <robh@xxxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Stafford Horne <shorne@xxxxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx> Cc: Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/arm/mm/init.c | 2 +- arch/sh/boards/mach-ap325rxa/setup.c | 2 +- arch/sh/boards/mach-ecovec24/setup.c | 4 ++-- arch/sh/boards/mach-kfr2r09/setup.c | 2 +- arch/sh/boards/mach-migor/setup.c | 2 +- arch/sh/boards/mach-se/7724/setup.c | 4 ++-- arch/xtensa/mm/kasan_init.c | 3 +-- 7 files changed, 9 insertions(+), 10 deletions(-) --- a/arch/arm/mm/init.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/arm/mm/init.c @@ -205,7 +205,7 @@ phys_addr_t __init arm_memblock_steal(ph BUG_ON(!arm_memblock_steal_permitted); - phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, align); memblock_free(phys, size); memblock_remove(phys, size); --- a/arch/sh/boards/mach-ap325rxa/setup.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/sh/boards/mach-ap325rxa/setup.c @@ -557,7 +557,7 @@ static void __init ap325rxa_mv_mem_reser phys_addr_t phys; phys_addr_t size = CEU_BUFFER_MEMORY_SIZE; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); --- a/arch/sh/boards/mach-ecovec24/setup.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/sh/boards/mach-ecovec24/setup.c @@ -1480,12 +1480,12 @@ static void __init ecovec_mv_mem_reserve phys_addr_t phys; phys_addr_t size = CEU_BUFFER_MEMORY_SIZE; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); ceu0_dma_membase = phys; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); ceu1_dma_membase = phys; --- a/arch/sh/boards/mach-kfr2r09/setup.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/sh/boards/mach-kfr2r09/setup.c @@ -631,7 +631,7 @@ static void __init kfr2r09_mv_mem_reserv phys_addr_t phys; phys_addr_t size = CEU_BUFFER_MEMORY_SIZE; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); --- a/arch/sh/boards/mach-migor/setup.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/sh/boards/mach-migor/setup.c @@ -630,7 +630,7 @@ static void __init migor_mv_mem_reserve( phys_addr_t phys; phys_addr_t size = CEU_BUFFER_MEMORY_SIZE; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); --- a/arch/sh/boards/mach-se/7724/setup.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/sh/boards/mach-se/7724/setup.c @@ -965,12 +965,12 @@ static void __init ms7724se_mv_mem_reser phys_addr_t phys; phys_addr_t size = CEU_BUFFER_MEMORY_SIZE; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); ceu0_dma_membase = phys; - phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); + phys = memblock_phys_alloc(size, PAGE_SIZE); memblock_free(phys, size); memblock_remove(phys, size); ceu1_dma_membase = phys; --- a/arch/xtensa/mm/kasan_init.c~memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc +++ a/arch/xtensa/mm/kasan_init.c @@ -52,8 +52,7 @@ static void __init populate(void *start, for (k = 0; k < PTRS_PER_PTE; ++k, ++j) { phys_addr_t phys = - memblock_alloc_base(PAGE_SIZE, PAGE_SIZE, - MEMBLOCK_ALLOC_ANYWHERE); + memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE); set_pte(pte + j, pfn_pte(PHYS_PFN(phys), PAGE_KERNEL)); } _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxx are powerpc-prefer-memblock-apis-returning-virtual-address.patch microblaze-prefer-memblock-api-returning-virtual-address.patch sh-prefer-memblock-apis-returning-virtual-address.patch openrisc-simplify-pte_alloc_one_kernel.patch arch-simplify-several-early-memory-allocations.patch arm-s390-unicore32-remove-oneliner-wrappers-for-memblock_alloc.patch openrisc-prefer-memblock-apis-returning-virtual-address.patch memblock-replace-memblock_alloc_baseanywhere-with-memblock_phys_alloc.patch memblock-drop-memblock_alloc_base_nid.patch memblock-emphasize-that-memblock_alloc_range-returns-a-physical-address.patch memblock-memblock_phys_alloc_try_nid-dont-panic.patch memblock-memblock_phys_alloc-dont-panic.patch memblock-drop-__memblock_alloc_base.patch memblock-drop-memblock_alloc_base.patch memblock-refactor-internal-allocation-functions.patch memblock-make-memblock_find_in_range_node-and-choose_memblock_flags-static.patch arch-use-memblock_alloc-instead-of-memblock_alloc_fromsize-align-0.patch arch-dont-memset0-memory-returned-by-memblock_alloc.patch ia64-add-checks-for-the-return-value-of-memblock_alloc.patch sparc-add-checks-for-the-return-value-of-memblock_alloc.patch mm-percpu-add-checks-for-the-return-value-of-memblock_alloc.patch init-main-add-checks-for-the-return-value-of-memblock_alloc.patch swiotlb-add-checks-for-the-return-value-of-memblock_alloc.patch treewide-add-checks-for-the-return-value-of-memblock_alloc.patch memblock-memblock_alloc_try_nid-dont-panic.patch memblock-drop-memblock_alloc__nopanic-variants.patch