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

From: David Hildenbrand (Arm)

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


On 4/14/26 14:11, Mike Rapoport wrote:
> 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

Nice :)

--
Cheers,

David