Re: [PATCH v3 6/6] arm64: mm: implement the architecture-specific test_and_clear_young_ptes()

From: Baolin Wang

Date: Mon Mar 09 2026 - 22:51:24 EST




On 3/9/26 10:39 PM, David Hildenbrand (Arm) wrote:

(b) The first pte is !pte_cont(), but some others in there are?

IMO they can’t be handled in a single batch. Since the folio_pte_batch()
will group consecutive !cont PTEs into one batch and consecutive cont
PTEs into another (assume all PTEs belong to a single large folio),
because their PTE entries have different CONT bits.
Interesting, thanks. I thought that folio_pte_batch() would be able to
batch that.

But yes, pte_batch_hint() relies on the CONT bit still being set after a
ptep_get(). I wonder whether we should document somewhere that the arm
implementation depends on that.

This might be something to look into in the future. (make
folio_pte_batch() ignore cont information when comparing and make the
arm implementation be able to deal with that).

Assume we unmapped the last page of a large folio. Ideally, we'd be able
to process the remaining THP pieces (all ptes) in a single operation. I
guess right now it would be two.

Right. Let me investigate this further and see if I can figure out how to optimize this case.

Thanks for reviewing.