Skip to content

Commit 817c16e

Browse files
committed
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
2 parents 4cf4465 + f043a93 commit 817c16e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

mm/numa_memblks.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,15 +570,16 @@ static int meminfo_to_nid(struct numa_meminfo *mi, u64 start)
570570
int phys_to_target_node(u64 start)
571571
{
572572
int nid = meminfo_to_nid(&numa_meminfo, start);
573+
int reserved_nid = meminfo_to_nid(&numa_reserved_meminfo, start);
573574

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

581-
return meminfo_to_nid(&numa_reserved_meminfo, start);
582+
return reserved_nid;
582583
}
583584
EXPORT_SYMBOL_GPL(phys_to_target_node);
584585

0 commit comments

Comments
 (0)