[PATCH v4 3/4] mm: Support batched unmap for lazyfree large folios during reclamation
Lance Yang
lance.yang at linux.dev
Thu Jun 26 08:06:11 PDT 2025
On 2025/6/26 22:39, David Hildenbrand wrote:
[...]
>>>> @@ -1870,12 +1870,13 @@ static inline unsigned int
>>>> folio_unmap_pte_batch(struct folio *folio,
>>>> return 1;
>>>> /* ... where we must be able to batch the whole folio. */
>>>
>>> Why is that still required? :)
>>
>> Sorry ... I was still stuck in the "all-or-nothing" mindset ...
>>
>> So, IIUC, you mean we should completely remove the "max_nr < nr_pages"
>> check and just let folio_pte_batch handle whatever partial batch it
>> safely can.
>>
>>>
>>>> - if (pte_pfn(pte) != folio_pfn(folio) || max_nr !=
>>>> folio_nr_pages(folio))
>>>> + if (pte_pfn(pte) != folio_pfn(folio) || max_nr < nr_pages)
>>>> return 1;
>>>> - max_nr = folio_pte_batch(folio, addr, pvmw->pte, pte, max_nr,
>>>> fpb_flags,
>>>> - NULL, NULL, NULL);
>>>> - return (max_nr != folio_nr_pages(folio)) ? 1 : max_nr;
>>>> + max_nr = folio_pte_batch(folio, addr, pvmw->pte, pte, nr_pages,
>>>> + fpb_flags, NULL, NULL, NULL);
>>>> +
>>>> + return (max_nr != nr_pages) ? 1 : max_nr;
>>>
>>> Why is that still required? :)
>>
>> Then simply return the number of PTEs that consecutively map to the
>> large folio. Right?
>
> Yes. Any part of the large folio. Just return folio_pte_batch() ...
>
Ah, got it. Thanks!
More information about the linux-riscv
mailing list