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

From: David Hildenbrand (Arm)

Date: Mon Apr 13 2026 - 15:07:15 EST


> -
> -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.

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

--
Cheers,

David