Re: [PATCH v2] memblock: move reserve_bootmem_range() to memblock.c and make it static
From: Mike Rapoport
Date: Mon Mar 23 2026 - 10:19:44 EST
On Mon, Mar 23, 2026 at 12:37:51PM +0000, Lorenzo Stoakes (Oracle) wrote:
> On Mon, Mar 23, 2026 at 09:20:42AM +0200, Mike Rapoport wrote:
> > From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
> >
> > reserve_bootmem_region() is only called from
> > memmap_init_reserved_pages() and it was in mm/mm_init.c because of its
> > dependecies on static init_deferred_page().
> >
> > Since init_deferred_page() is not static anymore, move
> > reserve_bootmem_region(), rename it to memmap_init_reserved_range() and
> > make it static.
> >
> > Update the comment describing it to better reflect what the function
> > does and drop bogus comment about reserved pages in free_bootmem_page().
> >
> > Update memblock test stubs to reflect the core changes.
> >
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
>
> LGTM and passed local tests so:
>
> Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@xxxxxxxxxx>
Thanks!
> > ---
>
> FYI I saw the below when running make in tools/testing/memblock, doesn't look
> related to this change but maybe something to address?
>
>
> cc -I. -I../../include -Wall -O2 -fsanitize=address -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT -c -o memblock.o memblock.c
> memblock.c: In function ‘memblock_add_range.isra’:
> memblock.c:710:17: warning: ‘end_rgn’ may be used uninitialized [-Wmaybe-uninitialized]
> 710 | memblock_merge_regions(type, start_rgn, end_rgn);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> memblock.c:616:42: note: ‘end_rgn’ was declared here
> 616 | int idx, nr_new, start_rgn = -1, end_rgn;
> | ^~~~~~~
Oddly enough it does not warn in the kernel build, so I kept ignoring this :)
Should be fixed indeed.
--
Sincerely yours,
Mike.