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 DEB101C3C04 for ; Fri, 10 Jan 2025 10:17:48 +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=1736504268; cv=none; b=gSiYoOb2W9YPsvJ2Vt6Na7GWvskksn/MJ2KsN3UiPd88dShwn9edCh5x3qGV29yYoDvbaBkNIb0+srysQaA+kJoAMew1fpNKiSendjpadCp6HCCXA1lcCKMvizIjPtnPdxFoAr56VNd/6VteQfIg8fcG07diAfiEEFxS/LGGFb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504268; c=relaxed/simple; bh=AIDZ4Zt6VkJjY9xmHhFXsRv+PULsS2USM+JOckKO3HE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nFk5hv781qxcXRvtKf19YBhVY0jh8d5HEzjtr1JnUWpNaj9UdqTYoT9sV632pQeGgdSKouMVZmdwDRx5MdcnHOktdu+FA4OjwLa0Kx+YiXHd3yKW5skOdsS2M9uUabpjkO6zkqNsWcqnWhaG0l/mAZ2Q537xk2UrYKDCBJkQP5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MXzRAJhU; 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="MXzRAJhU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B439C4CEDF; Fri, 10 Jan 2025 10:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736504268; bh=AIDZ4Zt6VkJjY9xmHhFXsRv+PULsS2USM+JOckKO3HE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MXzRAJhUP9n4r9W4RBKUa7y4zRSAWZBeBDPSpr5GgON9SMB5sDsn1N4b6ztHJpHDO IA363MwDAZg5y/DJULGJ2bnH4qfcsYVALsiP1JalJfszROym9wXZSCc9qauFnLWYkU QTmQBG8fU15LocJ7aVYkZlJTjzX1bHMFzXWnb1oR5vSY1JhQGpg5ckzjQdtIkFi4tE JX93pDUIylkGtUZmmLB1lN4jXsQwWypsUOvjMFeMu/sbP7szji+QjznADXN2dUSXSZ M4Zlh3Q3UPtjlwU+Fg7BXntxA+do5a72mDCVNjLWOoPT7Hir3nlMoBWJkjxxWAqVAC DXh9soyeCoVXQ== Date: Fri, 10 Jan 2025 12:17:37 +0200 From: Mike Rapoport To: Weikang Guo Cc: Christophe Leroy , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] mm/memblock: Modify the default failure behavior of memblock_alloc to panic Message-ID: References: <20250103105158.1350689-1-guoweikang.kernel@gmail.com> <39e6c57c-0a8f-4f4a-b6ae-27f2ef6bb8fa@csgroup.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Jan 06, 2025 at 11:03:38AM +0800, Weikang Guo wrote: > Hi,Christophe, Andrew > > Weikang Guo 于2025年1月6日周一 10:17写道: > > > > Hi,Christophe > > > > Christophe Leroy wrote on Saturday, 4 > > January 2025 03:58: > > > > > > > > > > > > Le 03/01/2025 à 11:51, Guo Weikang a écrit : > > > > After analyzing the usage of memblock_alloc, it was found that approximately > > > > 4/5 (120/155) of the calls expect a panic behavior on allocation failure. > > > > To reflect this common usage pattern, the default failure behavior of > > > > memblock_alloc is now modified to trigger a panic when allocation fails. > > > > > > > > Additionally, a new interface, memblock_alloc_no_panic, has been introduced > > > > to handle cases where panic behavior is not desired. > > > > > > Isn't that going in the opposite direction ? > > > > > > 5 years ago we did the exact reverse, see commit c0dbe825a9f1 > > > ("memblock: memblock_alloc_try_nid: don't panic") > > Thank you for providing the historical context. I did notice the > existence of a nopanic > version before. In my earlier patch, I introduced > memblock_alloc_or_panic, which offers > a more explicit interface to clearly indicate to callers that they > don't need to handle panic > separately. > > Andrew pointed out that in most scenarios, panic is the expected > behavior, while no_panic > represents an exceptional case. This feedback led to the current > patch, aiming to adjust the > default behavior and open it up for discussion within the community. > > However, after reviewing Mike's previous changes, I now believe that > further adjustment to > the default behavior might not be necessary, as it could lead to > confusion for many users. > In fact, the interface that is widely used externally is > memblock_alloc(), and I think providing memblock_alloc_or_panic > explicitly might already be sufficient. Agree > - memblock_alloc_or_panic: > https://lore.kernel.org/lkml/20250102150835.776fe72f565cc3232d83e6a7@linux-foundation.org/ > - Drop memblock_alloc_nopanic: > https://lore.kernel.org/lkml/1548057848-15136-1-git-send-email-rppt@linux.ibm.com/ > > > > > > > Christophe > > > > > > > -- Sincerely yours, Mike.