|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.21] xen/numa: fix setup of non-aligned memory affinity ranges
commit 94fa7e1626fd755a4cf70904ca463ed068eea6f1
Author: Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Jul 20 13:29:16 2026 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jul 20 13:29:16 2026 +0200
xen/numa: fix setup of non-aligned memory affinity ranges
The logic to populate memnodemap in populate_memnodemap() assumes that all
ranges are aligned to the hash shift, this however is only true for the
first address in a memory affinity node. Any subsequent ranges belonging
to the same node might not be aligned to the hash shift value.
Such lack of alignment causes issues to the logic in populate_memnodemap(),
as then the tail of the range might not be properly accounted for and setup
in memnodemap. Fix this by forcing the start address of all regions to
be aligned to the hash shift; if such alignment causes a region overlap it
would always be between regions on the same node, and hence will never
cause setup issues of the memnodemap array.
Fixes: 1666086b0044 ("x86/NUMA: improve memnode_shift calculation for multi
node system")
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
master commit: 188d5305297f4e842511d1374c7121ac8a37c169
master date: 2026-06-05 19:13:47 +0200
---
xen/common/numa.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/xen/common/numa.c b/xen/common/numa.c
index ad75955a16..e2c89bf55b 100644
--- a/xen/common/numa.c
+++ b/xen/common/numa.c
@@ -403,6 +403,12 @@ static int __init populate_memnodemap(const struct node
*nodes,
if ( (epdx >> shift) >= memnodemapsize )
return 0;
+ /*
+ * Round down start address: if start is not aligned to the memnodemap
+ * chunk size the tail remainder might not be added. Overlaps created
+ * by rounding will fall into the same NUMA region.
+ */
+ spdx = ROUNDDOWN(spdx, 1UL << shift);
do {
if ( memnodemap[spdx >> shift] != NUMA_NO_NODE &&
(!nodeids || memnodemap[spdx >> shift] != nodeids[i]) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |