diff mbox series

mm: numa_memblks: Don't skip reserved areas before DRAM

Message ID 20241022184142.5691-1-kyle.meyer@hpe.com (mailing list archive)
State New
Headers show
Series mm: numa_memblks: Don't skip reserved areas before DRAM | expand

Commit Message

Kyle Meyer Oct. 22, 2024, 6:41 p.m. UTC
memblock_start_of_DRAM() returns the base address of the 1st usable
memory region. Reserved memory regions can start before that address.

Instead of skipping the truncated portions of NUMA memory blocks that
start before DRAM, add them to 'numa_reserved_meminfo'. Without this
patch, reserved areas present in the SRAT before the start of DRAM are
not assigned a node ID.

Fixes: f7feea289f9a ("mm: numa_memblks: use memblock_{start,end}_of_DRAM() when sanitizing meminfo")
Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
---
 mm/numa_memblks.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/mm/numa_memblks.c b/mm/numa_memblks.c
index be52b93a9c58..384397d39d6d 100644
--- a/mm/numa_memblks.c
+++ b/mm/numa_memblks.c
@@ -227,10 +227,14 @@  int __init numa_cleanup_meminfo(struct numa_meminfo *mi)
 			continue;
 		}
 
-		/* make sure all non-reserved blocks are inside the limits */
-		bi->start = max(bi->start, low);
+		/* preserve info for reserved areas before DRAM */
+		if (bi->start < low) {
+			numa_add_memblk_to(bi->nid, bi->start, low,
+					   &numa_reserved_meminfo);
+			bi->start = low;
+		}
 
-		/* preserve info for non-RAM areas above 'max_pfn': */
+		/* preserve info for reserved areas after DRAM */
 		if (bi->end > high) {
 			numa_add_memblk_to(bi->nid, high, bi->end,
 					   &numa_reserved_meminfo);