Commit 817c16e5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull memblock fix from Mike Rapoport:
 "Fix detection of NUMA node for CXL windows

  phys_to_target_node() may assign a CXL Fixed Memory Window to the
  wrong NUMA node when a CXL node resides in the gap of discontinuous
  System RAM node.

  Fix this by checking both numa_meminfo and numa_reserved_meminfo,
  preferring the reserved NID when the address appears in both"

* tag 'fixes-2026-02-21' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  mm: numa_memblks: Identify the accurate NUMA ID of CFMW
parents 4cf44657 f043a93f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -570,15 +570,16 @@ static int meminfo_to_nid(struct numa_meminfo *mi, u64 start)
int phys_to_target_node(u64 start)
{
	int nid = meminfo_to_nid(&numa_meminfo, start);
	int reserved_nid = meminfo_to_nid(&numa_reserved_meminfo, start);

	/*
	 * Prefer online nodes, but if reserved memory might be
	 * hot-added continue the search with reserved ranges.
	 * Prefer online nodes unless the address is also described
	 * by reserved ranges, in which case use the reserved nid.
	 */
	if (nid != NUMA_NO_NODE)
	if (nid != NUMA_NO_NODE && reserved_nid == NUMA_NO_NODE)
		return nid;

	return meminfo_to_nid(&numa_reserved_meminfo, start);
	return reserved_nid;
}
EXPORT_SYMBOL_GPL(phys_to_target_node);