userfaultfd-shmem-modify-shmem_mfill_atomic_pte-to-use-install_pte.patch removed from -mm tree
The patch titled
Subject: userfaultfd/shmem: modify shmem_mfill_atomic_pte to use install_pte()
has been removed from the -mm tree. Its filename was
userfaultfd-shmem-modify-shmem_mfill_atomic_pte-to-use-install_pte.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Axel Rasmussen <[email protected]>
Subject: userfaultfd/shmem: modify shmem_mfill_atomic_pte to use install_pte()
In a previous commit, we added the mfill_atomic_install_pte() helper. This helper does the job of setting up PTEs for an existing page, to map it into a given VMA. It deals with both the anon and shmem cases, as well as the shared and private cases.
In other words, shmem_mfill_atomic_pte() duplicates a case it already handles. So, expose it, and let shmem_mfill_atomic_pte() use it directly, to reduce code duplication.
This requires that we refactor shmem_mfill_atomic_pte() a bit:
Instead of doing accounting (shmem_recalc_inode() et al) part-way through the PTE setup, do it afterward. This frees up mfill_atomic_install_pte() from having to care about this accounting, and means we don't need to e.g. shmem_uncharge() in the error path.
A side effect is this switches shmem_mfill_atomic_pte() to use lru_cache_add_inactive_or_unevictable() instead of just lru_cache_add(). This wrapper does some extra accounting in an exceptional case, if appropriate, so it's actually the more correct thing to use.
---
include/linux/userfaultfd_k.h | 5 ++ mm/shmem.c | 58 ++++++-------------------------- mm/userfaultfd.c | 17 +++------ 3 files changed, 23 insertions(+), 57 deletions(-)
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~userfaultfd-shmem-modify-shmem_mfill_atomic_pte-to-use-install_pte +5 -0
@@ -53,6 +53,11 @@ enum mcopy_atomic_mode { MCOPY_ATOMIC_CONTINUE, }; +extern int mfill_atomic_install_pte (struct mm_struct *dst_mm,pmd_t *dst_pmd, +struct vm_area_struct *dst_vma, +unsigned long dst_addr,struct page *page, +bool newly_allocated,bool wp_copy); +extern ssize_t mcopy_atomic (struct mm_struct *dst_mm,unsigned long dst_start,unsigned long src_start,unsigned long len,bool *mmap_changing,__u64 mode);
mm/shmem.c renamed from mm/shmem.c~userfaultfd-shmem-modify-shmem_mfill_atomic_pte-to-use-install_pte +12 -46
104 lines not on this page · raw message
mm/userfaultfd.c renamed from mm/userfaultfd.c~userfaultfd-shmem-modify-shmem_mfill_atomic_pte-to-use-install_pte +6 -11
@@ -51,18 +51,13 @@ struct vm_area_struct *find_dst_vma(stru/* * Install PTEs, to map dst_addr (within dst_vma) to page. * -* This function handles MCOPY_ATOMIC_CONTINUE (which is always file-backed), -* whether or not dst_vma is VM_SHARED. It also handles the more general -* MCOPY_ATOMIC_NORMAL case, when dst_vma is *not* VM_SHARED (it may be file -* backed, or not). -* -* Note that MCOPY_ATOMIC_NORMAL for a VM_SHARED dst_vma is handled by -* shmem_mcopy_atomic_pte instead. +* This function handles both MCOPY_ATOMIC_NORMAL and _CONTINUE for both shmem +* and anon, and for both shared and private VMAs. */ -static int mfill_atomic_install_pte (struct mm_struct *dst_mm,pmd_t *dst_pmd, -struct vm_area_struct *dst_vma, -unsigned long dst_addr,struct page *page, -bool newly_allocated,bool wp_copy) +int mfill_atomic_install_pte (struct mm_struct *dst_mm,pmd_t *dst_pmd, +struct vm_area_struct *dst_vma, +unsigned long dst_addr,struct page *page, +bool newly_allocated,bool wp_copy) {int ret;pte_t _dst_pte, *dst_pte;
_
Patches currently in -mm which might be from [email protected] are