Re: [RFC PATCH] mm/sparse: remove sparse_buffer
From: Muchun Song
Date: Fri Apr 10 2026 - 03:49:33 EST
> On Apr 10, 2026, at 15:44, David Hildenbrand (Arm) <david@xxxxxxxxxx> wrote:
>
> On 4/10/26 08:05, Muchun Song wrote:
>>
>>
>>> On Apr 10, 2026, at 11:07, Muchun Song <muchun.song@xxxxxxxxx> wrote:
>>>
>>>
>>>
>>>>
>>>> Hi,
>>>>
>>>>
>>>> memblock always allocates in order, so if there are no other memblock
>>>> allocations between the calls to memmap_alloc(), all these allocations will
>>>> be together and they all will be coalesced to a single region in
>>>> memblock.reserved.
>>>>
>>>>
>>>> ...
>>>>
>>>>
>>>> memmap_alloc() will be slower than sparse_buffer_alloc(), allocating from
>>>> memblock is more involved that sparse_buffer_alloc(), but without
>>>> measurements it's hard to tell how much it'll affect overall sparse_init().
>>>
>>> I ran a test on a 256GB VM, and the results are as follows:
>>>
>>> With patch: 741,292 ns
>>> Without patch: 199,555 ns
>>>
>>> The performance is approximately 3.7x slower with the patch applied.
>>
>> I also tested 512GB of data, and the results were roughly twice that
>> of 256GB, so for a 1TB machine, the memory allocation time is only a
>> few milliseconds. It seems we don’t need to worry about the 3.7x
>> performance drop.
>
> Good. Can you incorporate all that into the patch description?
>
Yes. No problem.
> --
> Cheers,
>
> David