The patch titled Subject: memblock: memblock_alloc_try_nid: don't panic has been added to the -mm tree. Its filename is memblock-memblock_alloc_try_nid-dont-panic.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/memblock-memblock_alloc_try_nid-dont-panic.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/memblock-memblock_alloc_try_nid-dont-panic.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: memblock_alloc_try_nid: don't panic As all the memblock_alloc*() users are now checking the return value and panic() in case of error, the panic() call can be removed from the core memblock allocator, namely memblock_alloc_try_nid(). Link: http://lkml.kernel.org/r/1548057848-15136-21-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> --- mm/memblock.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) --- a/mm/memblock.c~memblock-memblock_alloc_try_nid-dont-panic +++ a/mm/memblock.c @@ -1526,7 +1526,7 @@ void * __init memblock_alloc_try_nid_nop } /** - * memblock_alloc_try_nid - allocate boot memory block with panicking + * memblock_alloc_try_nid - allocate boot memory block * @size: size of memory block to be allocated in bytes * @align: alignment of the region and block's size * @min_addr: the lower bound of the memory region from where the allocation @@ -1536,9 +1536,8 @@ void * __init memblock_alloc_try_nid_nop * allocate only from memory limited by memblock.current_limit value * @nid: nid of the free area to find, %NUMA_NO_NODE for any node * - * Public panicking version of memblock_alloc_try_nid_nopanic() - * which provides debug information (including caller info), if enabled, - * and panics if the request can not be satisfied. + * Public function, provides additional debug information (including caller + * info), if enabled. This function zeroes the allocated memory. * * Return: * Virtual address of allocated memory block on success, NULL on failure. @@ -1555,14 +1554,10 @@ void * __init memblock_alloc_try_nid( &max_addr, (void *)_RET_IP_); ptr = memblock_alloc_internal(size, align, min_addr, max_addr, nid); - if (ptr) { + if (ptr) memset(ptr, 0, size); - return ptr; - } - panic("%s: Failed to allocate %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa\n", - __func__, (u64)size, (u64)align, nid, &min_addr, &max_addr); - return NULL; + return ptr; } /** _ 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