Re: [PATCH v2] mm/sparse: Remove sparse buffer pre-allocation mechanism

From: Mike Rapoport

Date: Tue Apr 14 2026 - 08:14:51 EST


On Mon, Apr 13, 2026 at 09:02:43PM +0200, David Hildenbrand (Arm) wrote:
> > -
> > -void * __meminit sparse_buffer_alloc(unsigned long size)
> > -{
> > - void *ptr = NULL;
> > -
> > - if (sparsemap_buf) {
> > - ptr = (void *) roundup((unsigned long)sparsemap_buf, size);
> > - if (ptr + size > sparsemap_buf_end)
> > - ptr = NULL;
> > - else {
> > - /* Free redundant aligned space */
> > - if ((unsigned long)(ptr - sparsemap_buf) > 0)
> > - sparse_buffer_free((unsigned long)(ptr - sparsemap_buf));
> > - sparsemap_buf = ptr + size;
>
> This code implied, that we would usually get contiguous memory sections
> (on the same node) to have contiguous PFNs in the SPARSE !VMEMMAP case.
> That will no longer be the case (reliably).
>
> The code must be prepared to handle that, so I guess that is fine. And
> we don't care that much about SPARSE !VMEMMAP.

I've started to hunt them down ;-P

https://lore.kernel.org/all/20260413104649.852228-1-rppt@xxxxxxxxxx/

> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>
> --
> Cheers,
>
> David

--
Sincerely yours,
Mike.