shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops.patch removed from -mm tree
The quilt patch titled
Subject: shmem, userfaultfd: implement shmem uffd operations using vm_uffd_ops
has been removed from the -mm tree. Its filename was
shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops.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: shmem, userfaultfd: implement shmem uffd operations using vm_uffd_ops
Date: Thu, 2 Apr 2026 07:11:51 +0300
Add filemap_add() and filemap_remove() methods to vm_uffd_ops and use them in __mfill_atomic_pte() to add shmem folios to page cache and remove them in case of error.
Implement these methods in shmem along with vm_uffd_ops->alloc_folio() and drop shmem_mfill_atomic_pte().
Since userfaultfd now does not reference any functions from shmem, drop include if linux/shmem_fs.h from mm/userfaultfd.c
mfill_atomic_install_pte() is not used anywhere outside of mm/userfaultfd, make it static.
---
include/linux/shmem_fs.h | 14 -- include/linux/userfaultfd_k.h | 19 ++-- mm/shmem.c | 150 +++++++++++--------------------- mm/userfaultfd.c | 80 ++++++++--------- 4 files changed, 107 insertions(+), 156 deletions(-)
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops +0 -14
@@ -221,20 +221,6 @@ static inline pgoff_t shmem_fallocend(stextern bool shmem_charge (struct inode *inode,long pages); -#ifdef CONFIG_USERFAULTFD -#ifdef CONFIG_SHMEM -extern int shmem_mfill_atomic_pte (pmd_t *dst_pmd, -struct vm_area_struct *dst_vma, -unsigned long dst_addr, -unsigned long src_addr, -uffd_flags_t flags, -struct folio **foliop); -#else /* !CONFIG_SHMEM */ -#define shmem_mfill_atomic_pte (dst_pmd, dst_vma, dst_addr, \ - src_addr, flags, foliop) ({ BUG(); 0; }) -#endif /* CONFIG_SHMEM */ -#endif /* CONFIG_USERFAULTFD */ -/* * Used space is stored as unsigned 64-bit value in bytes but * quota core supports only signed 64-bit values so use that
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops +14 -5
@@ -100,6 +100,20 @@ struct vm_uffd_ops {*/ struct folio *(*alloc_folio)(struct vm_area_struct *vma,unsigned long addr); +/* +* Called during resolution of UFFDIO_COPY request. +* Should only be called with a folio returned by alloc_folio() above. +* The folio will be set to locked. +* Returns 0 on success, error code on failure. +*/ +int (*filemap_add)(struct folio *folio,struct vm_area_struct *vma, +unsigned long addr); +/* +* Called during resolution of UFFDIO_COPY request on the error +* handling path. +* Should revert the operation of ->filemap_add(). +*/ +void (*filemap_remove)(struct folio *folio,struct vm_area_struct *vma); };/* A combined operation mode + behavior flags. */
@@ -133,11 +147,6 @@ static inline uffd_flags_t uffd_flags_se/* Flags controlling behavior. These behavior changes are mode-independent. */ #define MFILL_ATOMIC_WP MFILL_ATOMIC_FLAG(0) -extern int mfill_atomic_install_pte (pmd_t *dst_pmd, -struct vm_area_struct *dst_vma, -unsigned long dst_addr,struct page *page, -bool newly_allocated,uffd_flags_t flags); -extern ssize_t mfill_atomic_copy (struct userfaultfd_ctx *ctx,unsigned long dst_start,unsigned long src_start,unsigned long len,uffd_flags_t flags);
mm/shmem.c renamed from mm/shmem.c~shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops +54 -96
178 lines not on this page · raw message
mm/userfaultfd.c renamed from mm/userfaultfd.c~shmem-userfaultfd-implement-shmem-uffd-operations-using-vm_uffd_ops +39 -41
149 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are