Re: [PATCH 4/5] mm: support batched checking of the young flag for MGLRU

From: David Hildenbrand (Arm)

Date: Thu Feb 26 2026 - 04:15:17 EST



>>
>>> +            pte_t pteval = ptep_get(pvmw.pte);
>>
>> I wonder if there could be a way to avoid this ptep_get() by letting
>> page_vma_mapped_walk() just provide the last value it used (in
>> check_pte() I guess). Something for another patch.
>
> Well, we’d need to add a new field to ‘struct page_vma_mapped_walk’ to
> store the last value (e.g., pvmw.pteval),

Yes.

> but this makes me wonder if it
> is worth adding a new field just to avoid a lightweight read (which
> should have no obvious performance impact).

You recall that ptep_get() on arm64 is not that lightweight due to
con-pte? :)

But yeah, something for another day.

[...]

>>
>> What is "batched"? Did you mean "nr_ptes" ? Or just the initial value
>> for "nr" ?
>
> There is already an 'nr' variable in this function. "nr_ptes" sounds
> good to me, and will use it.

You can just use "nr" here and reuse it for the existing variable?

Both have the same semantics (nr of ptes / pages), so having a single
value might cause less confusion.

--
Cheers,

David