Re: [PATCH 3/4] mm/mprotect: un-inline folio_pte_batch_flags()
From: David Hildenbrand (Arm)
Date: Thu Mar 19 2026 - 17:43:27 EST
>
> This is all seems VERY delicate, and subject to somebody else coming along and
> breaking it/causing some of these noinline/__always_inline invocations to make
> things far worse.
>
> I also reserve the right to seriously rework this pile of crap software.
>
> I'd rather we try to find less fragile ways to optimise!
>
> Maybe there's some steps that are bigger wins than others?
What we can do is, collect similar folio_pte_batch_*() variants and
centralize them in mm/utils.c.
For
nr_ptes = mprotect_folio_pte_batch(folio, pte, oldpte,
max_nr_ptes, /* flags = */ 0)
We might just be able to use folio_pte_batch()?
For the other variant (soft-dirt+write) we'd have to create a helper like
folio_pte_batch_sd_w() [better name suggestion welcome]
That will reduce the code footprint overall I guess.
--
Cheers,
David