userfaultfd-use-per-vma-locks-in-userfaultfd-operations.patch removed from -mm tree
The quilt patch titled
Subject: userfaultfd: use per-vma locks in userfaultfd operations
has been removed from the -mm tree. Its filename was
userfaultfd-use-per-vma-locks-in-userfaultfd-operations.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: Lokesh Gidra <[email protected]>
Subject: userfaultfd: use per-vma locks in userfaultfd operations
Date: Thu, 15 Feb 2024 10:27:56 -0800
All userfaultfd operations, except write-protect, opportunistically use per-vma locks to lock vmas. On failure, attempt again inside mmap_lock critical section.
Write-protect operation requires mmap_lock as it iterates over multiple vmas.
---
fs/userfaultfd.c | 13 - include/linux/userfaultfd_k.h | 5 mm/huge_memory.c | 5 mm/userfaultfd.c | 382 ++++++++++++++++++++++++-------- 4 files changed, 300 insertions(+), 105 deletions(-)
fs/userfaultfd.c renamed from fs/userfaultfd.c~userfaultfd-use-per-vma-locks-in-userfaultfd-operations +2 -11
@@ -2005,17 +2005,8 @@ static int userfaultfd_move(struct userfreturn -EINVAL ;if (mmget_not_zero (mm)) { -mmap_read_lock (mm); - -/* Re-check after taking map_changing_lock */ -down_read (&ctx->map_changing_lock); -if (likely (!atomic_read (&ctx->mmap_changing))) - ret =move_pages (ctx, mm, uffdio_move.dst, uffdio_move.src, - uffdio_move.len, uffdio_move.mode); -else - ret = -EAGAIN ; -up_read (&ctx->map_changing_lock); -mmap_read_unlock (mm); + ret =move_pages (ctx, uffdio_move.dst, uffdio_move.src, + uffdio_move.len, uffdio_move.mode);mmput (mm); }else {return -ESRCH ;
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~userfaultfd-use-per-vma-locks-in-userfaultfd-operations +2 -3
@@ -138,9 +138,8 @@ extern long uffd_wp_range(struct vm_area/* move_pages */ void double_pt_lock (spinlock_t *ptl1,spinlock_t *ptl2);void double_pt_unlock (spinlock_t *ptl1,spinlock_t *ptl2); -ssize_t move_pages (struct userfaultfd_ctx *ctx,struct mm_struct *mm, -unsigned long dst_start,unsigned long src_start, -unsigned long len,__u64 flags); +ssize_t move_pages (struct userfaultfd_ctx *ctx,unsigned long dst_start, +unsigned long src_start,unsigned long len,__u64 flags); int move_pages_huge_pmd(struct mm_struct *mm, pmd_t *dst_pmd, pmd_t *src_pmd, pmd_t dst_pmdval, struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma,
mm/huge_memory.c renamed from mm/huge_memory.c~userfaultfd-use-per-vma-locks-in-userfaultfd-operations +3 -2
@@ -2158,7 +2158,7 @@ unlock:#ifdef CONFIG_USERFAULTFD /* -* The PT lock for src_pmd and the mmap_lock for reading are held by +* The PT lock for src_pmd and dst_vma/src_vma (for reading) are locked by * the caller, but it must return after releasing the page_table_lock. * Just move the page from src_pmd to dst_pmd if possible. * Return zero if succeeded in moving the page, -EAGAIN if it needs to be
@@ -2181,7 +2181,8 @@ int move_pages_huge_pmd(struct mm_struct src_ptl =pmd_lockptr (mm, src_pmd);lockdep_assert_held (src_ptl); -mmap_assert_locked (mm); +vma_assert_locked (src_vma); +vma_assert_locked (dst_vma);/* Sanity checks before the operation */ if (WARN_ON_ONCE(!pmd_none(dst_pmdval)) || WARN_ON_ONCE(src_addr & ~HPAGE_PMD_MASK) ||
mm/userfaultfd.c renamed from mm/userfaultfd.c~userfaultfd-use-per-vma-locks-in-userfaultfd-operations +293 -89
522 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are