On Fri, 2025-04-25 at 10:20 +0000, Bernardo C. Gutierrez Cantu wrote: > memblock_set_node() receives a `base` and a `size` arguments, but we are > passing the `start` and `end` of the memory regions when iterating over > them in memmap_init_reserved_pages() to set their node ids. > > This results in the function setting the node ids for the reserved memory > regions in `[base, base + base + size)` instead of `[base, base + size)`. > > Pass `start` and `size`, so that we iterate over the correct range. > > Fixes: 61167ad5fecd ("mm: pass nid to reserve_bootmem_region()") > > Signed-off-by: Bernardo C. Gutierrez Cantu Thanks, Bernardo. Good catch! Acked-by: David Woodhouse That function taking (start, size) arguments seems a little surprising to me; I instinctively expect physical memory management functions to use (start, end). Clearly the author of that commit did too :) As you pointed out in our private chat though, the rest of the memblock_* functions are all (start, size) too, so they are at least consistent. I don't think it makes a lot of sense to talk about changing them *all* at this point? I did a quick grep for memblock_set_node() callers, and the one in szmem() in arch/mips/loongson64/init.c looks odd. /* set nid for reserved memory */ memblock_set_node((u64)node << 44, (u64)(node + 1) << 44, &memblock.reserved, node); At first glance I suspect the 'size' should just be (1<<44) or maybe it should be inside the loop over the memmap, and called with mem_start, mem_size each time? And why are we calling memblock_reserve() for what appears to be a single system-wide vgabios_addr, repeatedly each time szmem() is called for a different NUMA node?