From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AB8FE77188 for ; Sun, 22 Dec 2024 10:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tD/eyhWrD4HhNOZEn3/W7xAZKDLQqhxEdB/QrX1G9x4=; b=ZNJI1Lususe0SZ /fS+q4czJ+U05i+f61MpZ22+kdqo8FnJ4zjtazXNQ6FTaTCXaMSlq0/zlYL3FbslDYbet0oB59Zq7 LAeh6w+WzOOiQseKJYkBDgH9brycpzUMqjJyee9GGUX/GSzGl0D456Qk5bu7WgmdQ3W9U7hgsDBjd UG1hFeMFejo4akAETU6XKtMoIoy7Q2BqsO0qr/jGCTOUcvJPbus/5TUdVMBAevm7bDvRat7QoA0/G dCDrhEV/Ky3gNOO/0IqsjQ1hUX84WGtaY/XqHFVyLZdlfpBfYk/hRL03U6WXLpU1uSrWVuUL01s97 lJGMR1mf9Aq8TXaeLC4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tPIrX-000000087kZ-3PSv; Sun, 22 Dec 2024 10:07:03 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tPIrV-000000087jQ-08nW; Sun, 22 Dec 2024 10:07:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 018E35C4689; Sun, 22 Dec 2024 10:06:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7832C4CECD; Sun, 22 Dec 2024 10:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734862017; bh=sHCtg4von/olng1R4HlYChWVtzpfTivVlSvduFQtli4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s3+eZLw2H4fsTfYy7R26AMbxlUMiT45Y42thwzbQ7PzYcjCMV+xxnbiGc5SjcS8ee N/pq6zKrdaTkA0THA/ohfrCjL8qwibt1MJ2o6NoUYUPkl8EkNQJF5tSH+SY+J1fE/8 Cvqm19I8xARPjWukujUbLNF0kg/VQ2JYfhr7BGGUm+m05r04yTqUEGCkxSjPDtezqD tVCjBp4QZY5na1pptfRr8OCkrj7c6+qsi21cr2LJfacf2iXQzPcBvoG6AX6jq7P+Mk T1nS6fK7nO7+rovxDAahs2X2IJBNreAhQtCCLuO9qzEwhrWBjbRlWnWXYxS/hWfdIV u6Jyj1v1mllWg== Date: Sun, 22 Dec 2024 12:06:22 +0200 From: Mike Rapoport To: Guo Weikang Cc: Andrew Morton , Geert Uytterhoeven , Dennis Zhou , Tejun Heo , Christoph Lameter , Thomas Bogendoerfer , Sam Creasey , Huacai Chen , Will Deacon , Catalin Marinas , Oreoluwa Babatunde , rafael.j.wysocki@intel.com, Palmer Dabbelt , Hanjun Guo , Easwar Hariharan , Johannes Berg , Ingo Molnar , Dave Hansen , Christian Brauner , KP Singh , Richard Henderson , Matt Turner , Russell King , WANG Xuerui , Michael Ellerman , Stefan Kristiansson , Stafford Horne , Helge Deller , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Geoff Levand , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Andreas Larsson , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, kasan-dev@googlegroups.com, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-acpi@vger.kernel.org, xen-devel@lists.xenproject.org, linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v6] mm/memblock: Add memblock_alloc_or_panic interface Message-ID: References: <20241222054331.2705948-1-guoweikang.kernel@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20241222054331.2705948-1-guoweikang.kernel@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241222_020701_176988_16594190 X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Sun, Dec 22, 2024 at 01:43:31PM +0800, Guo Weikang wrote: > Before SLUB initialization, various subsystems used memblock_alloc to > allocate memory. In most cases, when memory allocation fails, an immediate > panic is required. To simplify this behavior and reduce repetitive checks, > introduce `memblock_alloc_or_panic`. This function ensures that memory > allocation failures result in a panic automatically, improving code > readability and consistency across subsystems that require this behavior. > > Signed-off-by: Guo Weikang > --- ... > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index 673d5cae7c81..73af7ca3fa1c 100644 > --- a/include/linux/memblock.h > +++ b/include/linux/memblock.h > @@ -417,6 +417,12 @@ static __always_inline void *memblock_alloc(phys_addr_t size, phys_addr_t align) > MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); > } > > +void *__memblock_alloc_or_panic(phys_addr_t size, phys_addr_t align, > + const char *func); Please align this line with the first parameter to the function. Other than that Acked-by: Mike Rapoport (Microsoft) > + > +#define memblock_alloc_or_panic(size, align) \ > + __memblock_alloc_or_panic(size, align, __func__) > + > static inline void *memblock_alloc_raw(phys_addr_t size, > phys_addr_t align) > { -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv