From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09BD1846F; Sun, 22 Dec 2024 10:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734862018; cv=none; b=hx+MA92VCokCi+g7Q0JgtBwxhPmwqbE4czGuhC/rn5+PnwhRtJkPwHJ6Lw5/ARHAqiFpooBnkZXppISlVaqG1MXS42QCu8CFj/drhuQ+iSLVh622/DnfCIPHjHyZ3oeRq6Db8C9v5S+XICXdgjBJBJgaBiUp97dOQmju4rhm2y8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734862018; c=relaxed/simple; bh=sHCtg4von/olng1R4HlYChWVtzpfTivVlSvduFQtli4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a50+JPbNJAI3bk4/q3jWIul6AA9xfDxPRFOIsZvvwvQ85pFZgIkRqpRxuiq0ZbFyeJc/vx1V6a/vHYVvEyTQAKL5fxX00nKu01gMIJKg52JZOZUDk9aKaRUJ9NjbgkQldXrPcSjjV8uYhkb1OLV5waWbQAAzXwgAr2afudiDXpA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s3+eZLw2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s3+eZLw2" 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> Precedence: bulk X-Mailing-List: linux-openrisc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241222054331.2705948-1-guoweikang.kernel@gmail.com> 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.