From: David Woodhouse <dwmw2@infradead.org>
To: "Bernardo C. Gutierrez Cantu" <bercantu@amazon.de>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, lkp@intel.com, rppt@kernel.org,
yajun.deng@linux.dev, Huang Pei <huangpei@loongson.cn>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Huacai Chen <chenhuacai@kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
linux-mips <linux-mips@vger.kernel.org>
Subject: Re: [PATCH] mm: memblock: Fix arguments passed to memblock_set_node()
Date: Fri, 25 Apr 2025 15:18:07 +0100 [thread overview]
Message-ID: <16911666479b2fe4bc65944605199a8b3f12e875.camel@infradead.org> (raw)
In-Reply-To: <20250425102003.64122-1-bercantu@amazon.de>
[-- Attachment #1: Type: text/plain, Size: 1815 bytes --]
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@amazon.de>
Thanks, Bernardo. Good catch!
Acked-by: David Woodhouse <dwmw2@infradead.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?
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]
next prev parent reply other threads:[~2025-04-25 14:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 10:02 [PATCH v4] mm: pass nid to reserve_bootmem_region() Gutierrez Cantu, Bernardo
2025-04-25 10:20 ` [PATCH] mm: memblock: Fix arguments passed to memblock_set_node() Bernardo C. Gutierrez Cantu
2025-04-25 14:18 ` David Woodhouse [this message]
2025-04-25 14:37 ` Jiaxun Yang
2025-04-26 1:05 ` Andrew Morton
2025-04-28 9:13 ` Bernardo C. Gutierrez Cantu
2025-04-26 8:22 ` Mike Rapoport
2025-04-28 9:53 ` Bernardo C. Gutierrez Cantu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16911666479b2fe4bc65944605199a8b3f12e875.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bercantu@amazon.de \
--cc=chenhuacai@kernel.org \
--cc=huangpei@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=rppt@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=yajun.deng@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox