Skip to content

Batch unmap of uffd-wp file folios

Dev Jain linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 2 repliesIn review 2 of 3 applied
  2. v13 patches 7 repliesSuperseded

Changes in v2 from the cover letter

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

Patches in v2 2 of 3 applied

#Subject and filesSizeRepliesApplied
1/3mm/memory: move pte_install_uffd_wp_if_needed() into memory.cinclude/linux/mm_inline.h mm/internal.h mm/memory.c+63 -531 reply
2/3mm/memory: batch set uffd-wp markers during zappingmm/internal.h mm/memory.c mm/rmap.c+29 -391 replyApplied
3/3mm/rmap: batch unmap file folios belonging to uffd-wp VMAsmm/rmap.c+2 -40 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchDavid Hildenbrand (Arm)
1/3A-b
2/3A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

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

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/[email protected]/

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(-)
Signature · 1 line
2.43.0