Re: [PATCH v1 4/4] mm: remove boolean output parameters from folio_pte_batch_ext()

From: David Hildenbrand
Date: Fri Jun 27 2025 - 11:15:12 EST


On 27.06.25 16:34, Lance Yang wrote:
On Fri, Jun 27, 2025 at 7:55 PM David Hildenbrand <david@xxxxxxxxxx> wrote:

Instead, let's just allow for specifying through flags whether we want
to have bits merged into the original PTE.

For the madvise() case, simplify by having only a single parameter for
merging young+dirty. For madvise_cold_or_pageout_pte_range() merging the
dirty bit is not required, but also not harmful. This code is not that
performance critical after all to really force all micro-optimizations.

IIRC, this work you've wanted to do for a long time - maybe even a year ago?

Heh, maybe, I don't remember.

For this user here, I realized that we might already check the existence of any_dirty at runtime -- because the compiler will not necessarily create two optimized functions.

So we already have runtime checks ... instead of checking whether any_dirty == NULL, we now simply do the merging (checking for pte_young() instead) now.

--
Cheers,

David / dhildenb