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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 8669CE7718D for ; Sun, 22 Dec 2024 10:07:05 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4YGGzC3n9Vz2xjv; Sun, 22 Dec 2024 21:07:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2604:1380:4641:c500::1" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1734862023; cv=none; b=dPSOPwxF0mZkw/77DN+X+NCFNA4DVTHX80c+/3oNugOu7o1ARcyQDy0SL78rwht4nWgj5AZ2NE0+WA8g4JVleOqMctNGi5AVawDp1pxa1K5v7XauzqcbfgM7ZUkfMMK1PnC9OnJD4sRZXqGO7QE5ATUrBWt7KMCV8ozCJQdgt3rziVgEbgl9dpyM0db1MuzPfqbyGvaDwS9RVta8OuSnwi9ryaCtkcRGzeDd/gK+oUDYxM/lP5y/bd2je7GJfd7WyZkt1tBxpq3MJZPVDRU8H+tw8ZX4uJmLQ0gkFfEvp0KJdN1mq5GMJsj90GGZq9y6JfoVBrRqgrRpoKvLx0alaA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1734862023; c=relaxed/relaxed; bh=+hFbeVZytTc7as3NSImfMf3crm19rt/Slw/x+P9Woiw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AUhzrlw1HmSGp/RzT0e0FRaAjWeE8bHfBqHCtK6eNRmMXpesfsTPpZX/jSgpjOr8FHzmYdiWmKlzHwhqpnM3oI1xf1G+Kbeqh805kvcQK1zbO1x7mDQnU2aOtJKi0DVxOj1c7J3DRbbmhBHAKugS5GkwBPXCifzVA6benOTqoPOYbzWlVhVstUE8UG8LOAq/iCQTZ4peqUkajNZ2fIEaIBDLJB6zW0GDmso+EulvQYheBOtjONUKJ2hvhXDgcF456Zmxa8n7FNj6ib2Ny5oi6V1E24d2yjcyli2wsU9kkYFGevjJGa9T19kZBYl7CQsPTmEP4+KFvhVSBpSaZe8zOw== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=s3+eZLw2; dkim-atps=neutral; spf=pass (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=rppt@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=s3+eZLw2; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=rppt@kernel.org; receiver=lists.ozlabs.org) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4YGGzB29z9z2xfb for ; Sun, 22 Dec 2024 21:07:02 +1100 (AEDT) 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> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , 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.