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 DFDD713957E for ; Tue, 30 Dec 2025 15:18:38 +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=1767107919; cv=none; b=Gs59RPuJu4mYUMfqN67KFdgxYJ7vjnYDdFsE7Q/T0Mh4g/RsAOcQoe3wzVBnkC5pKxzg6VmDpnVgeSJDxwjYFCVHAyn51lu7ux3L+pVyiceMcfKwZzt5OhuotXsdfxWgP1N9sycRJKkt5EgYDzXT9OEIQd5V/ZH27efMUhmjESY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767107919; c=relaxed/simple; bh=uP8nasKdKb+PcbMkId6b5sqiArUgja3MgEI2FVs12Bk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=asOXihlp7E7j67FEZBqIyeUfBWQm1te6Xyuf2PiywgNRLSh2wtcRGrdAwGMgBYbC96kXEw9buEmNHdnCYNaXsyhEfB21SSg1nfl/fjkmeMEBYmZxK6cya8vxJR3zBogSQ2ZWNN0h122zt0LgbHHOHyQFk6xtmVkVYU03yltNzyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mLdb+2NT; 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="mLdb+2NT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA475C4CEFB; Tue, 30 Dec 2025 15:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767107918; bh=uP8nasKdKb+PcbMkId6b5sqiArUgja3MgEI2FVs12Bk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mLdb+2NToBkKVWysIBrQpyfhVJUmL8h9Av8kP4Ley9L96/tQ1OvfdzmuBdhyiM+m3 +xTkxMT5J5eJelVHORyKLnhKqE3t+pZJosEs+OhVg1neZDGGG0REwHNls03ojtP4nf dFs5bXs+dDi9w/wYuJOlNKBQ0usyi8OywOWEcP8XppZ5Irggp2XqiOgTtggafWPjJJ Da7vWfalVl335nOyIpAG7jbnzqzj41I1ENXrGka+usCiCfPLkRblQWHjCAMg+o82HR hQJuszsMjHNv1PRZF0wSSV6J9/ffWOpBXkm6CNahuRla5vErajaIDjSIu3SbaPaRCy ioE6arj6UzMBA== Date: Tue, 30 Dec 2025 17:18:32 +0200 From: Mike Rapoport To: Cui Chao Cc: Andrew Morton , Joanthan Cameron , wangyinfeng@phytium.com.cn, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: numa_memblks: Identify the accurate NUMA ID of CFMW Message-ID: References: <20251230092750.856060-1-cuichao1753@phytium.com.cn> 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=us-ascii Content-Disposition: inline In-Reply-To: <20251230092750.856060-1-cuichao1753@phytium.com.cn> Hi, On Tue, Dec 30, 2025 at 05:27:50PM +0800, Cui Chao wrote: > In some physical memory layout designs, the address space of CFMW > resides between multiple segments of system memory belonging to > the same NUMA node. In numa_cleanup_meminfo, these multiple segments > of system memory are merged into a larger numa_memblk. When > identifying which NUMA node the CFMW belongs to, it may be incorrectly > assigned to the NUMA node of the merged system memory. To address this Can you please provide an example of such memory layout? > scenario, accurately identifying the correct NUMA node can be achieved > by checking whether the region belongs to both numa_meminfo and > numa_reserved_meminfo. > > Signed-off-by: Cui Chao > --- > mm/numa_memblks.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c > index 5b009a9cd8b4..1ef037f0e0e0 100644 > --- a/mm/numa_memblks.c > +++ b/mm/numa_memblks.c > @@ -573,7 +573,8 @@ int phys_to_target_node(u64 start) > * Prefer online nodes, but if reserved memory might be > * hot-added continue the search with reserved ranges. > */ > - if (nid != NUMA_NO_NODE) > + if (nid != NUMA_NO_NODE && > + meminfo_to_nid(&numa_reserved_meminfo, start) == NUMA_NO_NODE) I'd suggest assigning the result of meminfo_to_nid(&numa_reserved_meminfo, start) to a local variable and using that in if and return statements. > return nid; > > return meminfo_to_nid(&numa_reserved_meminfo, start); > -- > 2.33.0 > > -- Sincerely yours, Mike.