[PATCH v2 0/3] Batch unmap of uffd-wp file folios

Dev Jain posted 3 patches 4 days, 19 hours ago
include/linux/mm_inline.h | 53 ------------------------
mm/internal.h             |  4 ++
mm/memory.c               | 85 ++++++++++++++++++++++++++++++---------
mm/rmap.c                 |  6 +--
4 files changed, 73 insertions(+), 75 deletions(-)
[PATCH v2 0/3] Batch unmap of uffd-wp file folios
Posted by Dev Jain 4 days, 19 hours ago
Currently, batched unmapping is supported if:

1) folio is a file folio, not belonging to uffd-wp VMA
2) folio is anonymous and not swapbacked (lazyfree), not belonging to
   uffd-wp VMA

So the cases which are not supported are

1) folio belonging to uffd-wp VMA
2) folio is anonymous and swapbacked

It is easy to see that this adds a lot of cognitive load while reading
try_to_unmap_one - we need to remember throughout whether nr_pages == 1
or > 1.

The uffd-wp handling in try_to_unmap_one is regarding preserving the
uffd-wp state for file folios via pte_install_uffd_wp_if_needed (for anon
folio, we handle that while constructing the swap pte).

Stop special casing on uffd-wp VMAs by simply adding batching support
to pte_install_uffd_wp_if_needed.

---
v1->v2:
- Move declaration to mm/internal.h
- Use two tabs for parameter indentation, use for(;;) established pattern
  for batch setting of ptes

This is a split from:
https://lore.kernel.org/all/20260526063635.61721-1-dev.jain@arm.com/

mm-selftests pass.

Dev Jain (3):
  mm/memory: move pte_install_uffd_wp_if_needed() into memory.c
  mm/memory: batch set uffd-wp markers during zapping
  mm/rmap: batch unmap file folios belonging to uffd-wp VMAs

 include/linux/mm_inline.h | 53 ------------------------
 mm/internal.h             |  4 ++
 mm/memory.c               | 85 ++++++++++++++++++++++++++++++---------
 mm/rmap.c                 |  6 +--
 4 files changed, 73 insertions(+), 75 deletions(-)

-- 
2.43.0