Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Batch unmap of uffd-wp file folios
@ 2026-07-15 11:18 Dev Jain
  2026-07-15 11:18 ` [PATCH 1/3] mm/memory: move pte_install_uffd_wp_if_needed() into memory.c Dev Jain
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dev Jain @ 2026-07-15 11:18 UTC (permalink / raw)
  To: akpm, david, ljs
  Cc: Dev Jain, liam, vbabka, rppt, surenb, mhocko, kasong, qi.zheng,
	shakeel.butt, baohua, axelrasmussen, yuanchu, weixugc, linux-mm,
	linux-kernel, riel, harry, jannh, lance.yang, ryan.roberts,
	anshuman.khandual

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.

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

mm-selftests pass.

I have based this on mm-new since my try_to_unmap_one refactoring changes
weren't there in mm-unstable yet. But I suspect this series wouldn't
have conflicted there, or conflicted trivially.

mm-new currently has Kiryl's uffd-rwp series, which confuses me about
the terminology followed by my patchset (and the existing functions):
shall I call it uffd-wp bit or uffd bit?

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.h        |  4 ++
 include/linux/mm_inline.h | 53 ------------------------
 mm/memory.c               | 84 +++++++++++++++++++++++++++++----------
 mm/rmap.c                 |  6 +--
 4 files changed, 70 insertions(+), 77 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-15 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 11:18 [PATCH 0/3] Batch unmap of uffd-wp file folios Dev Jain
2026-07-15 11:18 ` [PATCH 1/3] mm/memory: move pte_install_uffd_wp_if_needed() into memory.c Dev Jain
2026-07-15 11:18 ` [PATCH 2/3] mm/memory: batch set uffd-wp markers during zapping Dev Jain
2026-07-15 11:18 ` [PATCH 3/3] mm/rmap: batch unmap file folios belonging to uffd-wp VMAs Dev Jain
2026-07-15 18:58 ` [PATCH 0/3] Batch unmap of uffd-wp file folios Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox