Re: [PATCH v4 3/4] mm: Support batched unmap for lazyfree large folios during reclamation

From: David Hildenbrand
Date: Thu Jun 26 2025 - 17:53:13 EST


On 26.06.25 23:46, Barry Song wrote:
On Thu, Jun 26, 2025 at 9:29 PM Lance Yang <ioworker0@xxxxxxxxx> wrote:

[...]
+
+ /*
+ * If we are sure that we batched the entire folio and cleared
+ * all PTEs, we can just optimize and stop right here.
+ */
+ if (nr_pages == folio_nr_pages(folio))

David also mentioned if (nr_pages > 1 && nr_pages == folio_nr_pages(folio)).
I assume it’s still fine when nr_pages == 1 for small folios? No?

Yeah, as raised I think it is fine. We should never have any folio page mapped multiple times into the same VMA in any case. (excluding KSM pages, but they are handled differenty, using a specialized rmap walk)

--
Cheers,

David / dhildenb