[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <16911666479b2fe4bc65944605199a8b3f12e875.camel@infradead.org>
Date: Fri, 25 Apr 2025 15:18:07 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: "Bernardo C. Gutierrez Cantu" <bercantu@...zon.de>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, lkp@...el.com, rppt@...nel.org, yajun.deng@...ux.dev,
Huang Pei <huangpei@...ngson.cn>, Thomas Bogendoerfer
<tsbogend@...ha.franken.de>, Huacai Chen <chenhuacai@...nel.org>, Jiaxun
Yang <jiaxun.yang@...goat.com>, linux-mips <linux-mips@...r.kernel.org>
Subject: Re: [PATCH] mm: memblock: Fix arguments passed to
memblock_set_node()
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 <bercantu@...zon.de>
Thanks, Bernardo. Good catch!
Acked-by: David Woodhouse <dwmw2@...radead.org>
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?
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)
Powered by blists - more mailing lists