Re: [PATCH v4 0/3] mm: Free contiguous order-0 pages efficiently
From: David Hildenbrand (Arm)
Date: Mon Mar 30 2026 - 11:09:18 EST
On 3/27/26 20:42, Andrew Morton wrote:
> On Fri, 27 Mar 2026 12:57:12 +0000 Muhammad Usama Anjum <usama.anjum@xxxxxxx> wrote:
>
>> A recent change to vmalloc caused some performance benchmark regressions (see
>> [1]). I'm attempting to fix that (and at the same time significantly improve
>> beyond the baseline) by freeing a contiguous set of order-0 pages as a batch.
>>
>> At the same time I observed that free_contig_range() was essentially doing the
>> same thing as vfree() so I've fixed it there too. While at it, optimize the
>> __free_contig_frozen_range() as well.
>>
>> Check that the contiguous range falls in the same section. If they aren't enabled,
>> the if conditions get optimized out by the compiler as memdesc_section() returns 0.
>> See num_pages_contiguous() for more details about it.
>
> Thanks. I'm seeing impressive speedups for microbenchmarks. The
> speedup in [3/3] may be a bit more real-worldy.
This should speedup virtio-mem memory hotplug in cases where we end up
calling free_contig_range() on MAX_PAGE_ORDER ranges to release
hotplugged memory to the buddy!
--
Cheers,
David