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 9B8451D54FA; Mon, 10 Mar 2025 08:28:23 +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=1741595303; cv=none; b=dT3n1k4vGgi36HDvQzi+JLJKxAffI01ms4FnzlTvrnzCACwwVfNJJMdZtNhU2c+5TquT0h7BnbMUnCkh4+uBIIiApDCp+yGnCoWGO3wsVdVJCl09XgilgNeIq/PDLnAKJh4E/9DWawY6F7kcP4zJak79AFyNs5YaI+WH7VRF9VM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741595303; c=relaxed/simple; bh=7uCFQcex+j6cpQPJF/6LfRBEaDs9jns/4ey91A2Sm5Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PLFjUHdFQo9/XyDWZRIIrUQn/sDUHV8ZAnxjCr7ahbhY03rzYD7qefrLl+VpY+XcoPaOKhV/gcOyfsRcmbKbHfy5lAFOxru24YGnYVYZg1nWtDVMxLVkwaGO9NVDXWWd0JLI90cTjPX4eZAgXOGA+IU4Ab6ku3b2R1Mzg4KLXds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dt+61OBu; 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="Dt+61OBu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20474C4CEED; Mon, 10 Mar 2025 08:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741595303; bh=7uCFQcex+j6cpQPJF/6LfRBEaDs9jns/4ey91A2Sm5Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Dt+61OBuhSx0XzWa7kuR97NtRZolf+Ni76hFMdBs33YLt/1k+RMsxShKq8ywE5izv Xq0lyi+y7SJzKRcmF6pLe0/pMIp2CN1NtohvIhp4Lfz70fUXaKP8fdlcvDgL6nFqFz egPccLakn6UNDZwAc49vCsDGQvAccm2S6VOGcQu87kNkGYRfcWBfvdZMHBeMdQgSn4 J/L+XCc+GdJd0FpcGKyrg/IzPOfmKo79PxsSU2iqjEbBsVqKufsF8EZdPd3pBHuFq6 ipnF9XH2wTyTICRsMyZozegPxkb/EOVYqYIAdiNDHZduHzAW48E8qnjKEoT8Kf1pgw OUmx0WBZnksfg== Date: Mon, 10 Mar 2025 10:28:02 +0200 From: Mike Rapoport To: Wei Yang Cc: linux-kernel@vger.kernel.org, Alexander Graf , Andrew Morton , Andy Lutomirski , Anthony Yznaga , Arnd Bergmann , Ashish Kalra , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Dave Hansen , David Woodhouse , Eric Biederman , Ingo Molnar , James Gowans , Jonathan Corbet , Krzysztof Kozlowski , Mark Rutland , Paolo Bonzini , Pasha Tatashin , "H. Peter Anvin" , Peter Zijlstra , Pratyush Yadav , Rob Herring , Rob Herring , Saravana Kannan , Stanislav Kinsburskii , Steven Rostedt , Thomas Gleixner , Tom Lendacky , Usama Arif , Will Deacon , devicetree@vger.kernel.org, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: Re: [PATCH v4 02/14] memblock: add MEMBLOCK_RSRV_KERN flag Message-ID: References: <20250206132754.2596694-1-rppt@kernel.org> <20250206132754.2596694-3-rppt@kernel.org> <20250218155004.n53fcuj2lrl5rxll@master> <20250224013131.fzz552bn7fs64umq@master> <20250226020915.ytxusrrl7rv4g64l@master> <20250310075627.5hettrn2j2ien5bj@master> Precedence: bulk X-Mailing-List: devicetree@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: <20250310075627.5hettrn2j2ien5bj@master> Hi Wei, On Mon, Mar 10, 2025 at 07:56:27AM +0000, Wei Yang wrote: > On Wed, Feb 26, 2025 at 02:09:15AM +0000, Wei Yang wrote: > >>> > >>> From the above call flow and background, there are three cases when > >>> memblock_alloc_range_nid() would be called: > >>> > >>> * If it is called before (1), memblock.reserved's nid would be adjusted correctly. > >>> * If it is called after (2), we don't touch memblock.reserved. > >>> * If it happens between (1) and (2), it looks would break the consistency of > >>> nid information in memblock.reserved. Because when we use > >>> memblock_reserve_kern(), NUMA_NO_NODE would be stored in region. > >>> > >>> So my question is if the third case happens, would it introduce a bug? If it > >>> won't happen, seems we don't need to specify the nid here? > >> > >>We don't really care about proper assignment of nodes between (1) and (2) > >>from one side and the third case does not happen on the other side. Nothing > >>should call membloc_alloc() after memblock_free_all(). > >> > > > >My point is if no one would call memblock_alloc() after memblock_free_all(), > >which set nid in memblock.reserved properly, it seems not necessary to do > >__memblock_reserve() with exact nid during memblock_alloc()? > > > >As you did __memblock_reserve(found, size, nid, MEMBLOCK_RSRV_KERN) in this > >patch. > > > > Hi, Mike > > Do you think my understanding is reasonable? Without KHO it is indeed not strictly necessary to set nid during memblock_alloc(). But since we anyway have nid parameter in memblock_alloc_range_nid() and it anyway propagates to memblock_add_range(), I think it's easier and cleaner to pass nid to __memblock_reserve() there. And for KHO estimation of scratch size it is important to have nid assigned to the reserved areas before memblock_free_all(), at least for the allocations that request particular nid explicitly. > -- > Wei Yang > Help you, Help me -- Sincerely yours, Mike.