Re: [PATCH v4 0/3] mm: Free contiguous order-0 pages efficiently

Andrew Morton
2026-03-27T19:42:55Z

On Fri, 27 Mar 2026 12:57:12 +0000 Muhammad Usama Anjum <usama.anjum@arm.com> 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.

Do you have a feeling for how much difference these changes will make
for any real-world workload?

Also, AI review said things:
https://sashiko.dev/#/patchset/20260327125720.2270651-1-usama.anjum@arm.com

The can_free one (at least) seems legit. I suggest that can_free be
made local to that for() loop - this would clear things up a bit.