Merge tag 'fixes-2026-02-21' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock

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
This commit is contained in:
Linus Torvalds
2026-02-21 09:58:22 -08:00

View File

@@ -570,15 +570,16 @@ static int meminfo_to_nid(struct numa_meminfo *mi, u64 start)
int phys_to_target_node(u64 start) int phys_to_target_node(u64 start)
{ {
int nid = meminfo_to_nid(&numa_meminfo, 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 * Prefer online nodes unless the address is also described
* hot-added continue the search with reserved ranges. * 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 nid;
return meminfo_to_nid(&numa_reserved_meminfo, start); return reserved_nid;
} }
EXPORT_SYMBOL_GPL(phys_to_target_node); EXPORT_SYMBOL_GPL(phys_to_target_node);