Skip to contentSkip to conversation

userfaultfd-introduce-vm_uffd_ops-alloc_folio.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 18

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled

     Subject: userfaultfd: introduce vm_uffd_ops->alloc_folio()

has been removed from the -mm tree. Its filename was
userfaultfd-introduce-vm_uffd_ops-alloc_folio.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Mike Rapoport (Microsoft)" <[email protected]>
Subject: userfaultfd: introduce vm_uffd_ops->alloc_folio()
Date: Thu, 2 Apr 2026 07:11:50 +0300

and use it to refactor mfill_atomic_pte_zeroed_folio() and mfill_atomic_pte_copy().

mfill_atomic_pte_zeroed_folio() and mfill_atomic_pte_copy() perform almost identical actions:
* allocate a folio
* update folio contents (either copy from userspace of fill with zeros)
* update page tables with the new folio

Split a __mfill_atomic_pte() helper that handles both cases and uses newly introduced vm_uffd_ops->alloc_folio() to allocate the folio.

Pass the ops structure from the callers to __mfill_atomic_pte() to later allow using anon_uffd_ops for MAP_PRIVATE mappings of file-backed VMAs.

Note, that the new ops method is called alloc_folio() rather than folio_alloc() to avoid clash with alloc_tag macro folio_alloc().

Cc Andrea Arcangeli <[email protected]>
Cc Andrei Vagin <[email protected]>
Cc Axel Rasmussen <[email protected]>
Cc Baolin Wang <[email protected]>
Cc David Hildenbrand (Arm) <[email protected]>
Cc Harry Yoo <[email protected]>
Cc Harry Yoo (Oracle) <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Lorenzo Stoakes (Oracle) <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Muchun Song <[email protected]>
Cc Nikita Kalyazin <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Peter Xu <[email protected]>
Cc Sean Christopherson <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc David Carlier <[email protected]>

---

 include/linux/userfaultfd_k.h |    6 ++
 mm/userfaultfd.c              |   92 ++++++++++++++++----------------
 2 files changed, 54 insertions(+), 44 deletions(-)
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~userfaultfd-introduce-vm_uffd_ops-alloc_folio +6 -0
@@ -94,6 +94,12 @@ struct vm_uffd_ops {
 	 * The returned folio is locked and with reference held.
 	 */
 	struct folio *(*get_folio_noalloc)(struct inode *inode, pgoff_t pgoff);
+	/*
+	 * Called during resolution of UFFDIO_COPY request.
+	 * Should allocate and return a folio or NULL if allocation fails.
+	 */
+	struct folio *(*alloc_folio)(struct vm_area_struct *vma,
+				     unsigned long addr);
 };
 
 /* A combined operation mode + behavior flags. */
mm/userfaultfd.c renamed from mm/userfaultfd.c~userfaultfd-introduce-vm_uffd_ops-alloc_folio +48 -44

142 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are