Re: [PATCH v2 5/6] mm: support batched checking of the young flag for MGLRU
From: David Hildenbrand (Arm)
Date: Tue Mar 03 2026 - 04:02:47 EST
>> unsigned long pfn;
>> struct folio *folio;
>> - pte_t ptent = ptep_get(pte + i);
>> + pte_t ptent = ptep_get(pte);
>> + nr = 1;
>> total++;
>> walk->mm_stats[MM_LEAF_TOTAL]++;
>> @@ -3533,7 +3534,16 @@ static bool walk_pte_range(pmd_t *pmd,
>> unsigned long start, unsigned long end,
>> if (!folio)
>> continue;
>
> Thanks for the code. I considered simplifying the logic this way, but
> this logic would be incorrect. Because the 'start' can be updated by the
> get_next_vma() below, when we goto restart, we will get a new 'i' value
> by 'pte_index(start)', so I kept the 'i' variable.
You're right, that's some horrible, horrible code.
--
Cheers,
David