[PATCH v2 20/21] memblock: memblock_alloc_try_nid: don't panic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: linux-mm@xxxxxxxxx
- Subject: [PATCH v2 20/21] memblock: memblock_alloc_try_nid: don't panic
- From: Mike Rapoport <rppt@xxxxxxxxxxxxx>
- Date: Mon, 21 Jan 2019 10:04:07 +0200
- Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Christoph Hellwig <hch@xxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Guan Xuetao <gxt@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, Heiko Carstens <heiko.carstens@xxxxxxxxxx>, Mark Salter <msalter@xxxxxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Michal Simek <monstr@xxxxxxxxx>, Paul Burton <paul.burton@xxxxxxxx>, Petr Mladek <pmladek@xxxxxxxx>, Rich Felker <dalias@xxxxxxxx>, Richard Weinberger <richard@xxxxxx>, Rob Herring <robh+dt@xxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Stafford Horne <shorne@xxxxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, Vineet Gupta <vgupta@xxxxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, devicetree@xxxxxxxxxxxxxxx, kasan-dev@xxxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-c6x-dev@xxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, openrisc@xxxxxxxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, uclinux-h8-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Mike Rapoport <rppt@xxxxxxxxxxxxx>
- In-reply-to: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>
- References: <1548057848-15136-1-git-send-email-rppt@linux.ibm.com>
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().
Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>
---
mm/memblock.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 03b3929..7164275 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1526,7 +1526,7 @@ void * __init memblock_alloc_try_nid_nopanic(
}
/**
- * 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_nopanic(
* 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;
}
/**
--
2.7.4
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]