[PATCH v4 02/14] memblock: add MEMBLOCK_RSRV_KERN flag
Mike Rapoport
rppt at kernel.org
Thu Mar 13 08:41:47 PDT 2025
Hi Changyuan,
On Tue, Feb 25, 2025 at 05:53:39PM -0800, Changyuan Lyu wrote:
> Hi Mike,
>
> On Thu, 6 Feb 2025 15:27:42 +0200, Mike Rapoport <rppt at kernel.org> wrote:
> > From: "Mike Rapoport (Microsoft)" <rppt at kernel.org>
> >
> > to denote areas that were reserved for kernel use either directly with
> > memblock_reserve_kern() or via memblock allocations.
> >
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt at kernel.org>
> > ---
> > include/linux/memblock.h | 16 +++++++++++++++-
> > mm/memblock.c | 32 ++++++++++++++++++++++++--------
> > 2 files changed, 39 insertions(+), 9 deletions(-)
> >
> > diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> > index e79eb6ac516f..65e274550f5d 100644
> > --- a/include/linux/memblock.h
> > +++ b/include/linux/memblock.h
> > ......
> > @@ -116,7 +117,19 @@ int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid,
> > int memblock_add(phys_addr_t base, phys_addr_t size);
> > int memblock_remove(phys_addr_t base, phys_addr_t size);
> > int memblock_phys_free(phys_addr_t base, phys_addr_t size);
> > -int memblock_reserve(phys_addr_t base, phys_addr_t size);
> > +int __memblock_reserve(phys_addr_t base, phys_addr_t size, int nid,
> > + enum memblock_flags flags);
> > +
> > +static __always_inline int memblock_reserve(phys_addr_t base, phys_addr_t size)
> > +{
> > + return __memblock_reserve(base, size, NUMA_NO_NODE, 0);
>
> Without this patch `memblock_reserve` eventually calls `memblock_add_range`
> with `MAX_NUMNODES`, but with this patch, `memblock_reserve` calls
> `memblock_add_range` with `NUMA_NO_NODE`. Is it intended or an
> accidental typo? Thanks!
We were mixing NUMA_NO_NODE and MAX_NUMNODES for memory with undefined node
id for a while, with MAX_NUMNODES being older and NUMA_NO_NODE newer define
for the same thing.
To make sure both are treated correctly in memblock we use
numa_valid_node() to check if a range has node id set.
> Best,
> Changyuan
--
Sincerely yours,
Mike.
More information about the linux-arm-kernel
mailing list