diff mbox series

[RFC,10/24] handle_userfault: use the vmf->range field when dropping mmap_sem

Message ID 20200224203057.162467-11-walken@google.com (mailing list archive)
State New, archived
Headers show
Series Fine grained MM locking | expand

Commit Message

Michel Lespinasse Feb. 24, 2020, 8:30 p.m. UTC
Change handle_userfault to drop the proper memory range
as indicated in the vmf.

Signed-off-by: Michel Lespinasse <walken@google.com>
---
 fs/userfaultfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git fs/userfaultfd.c fs/userfaultfd.c
index f38095a7ebcd..2b8ee3eaacd7 100644
--- fs/userfaultfd.c
+++ fs/userfaultfd.c
@@ -489,7 +489,7 @@  vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason)
 		must_wait = userfaultfd_huge_must_wait(ctx, vmf->vma,
 						       vmf->address,
 						       vmf->flags, reason);
-	mm_read_unlock(mm);
+	mm_read_range_unlock(mm, vmf->range);
 
 	if (likely(must_wait && !READ_ONCE(ctx->released) &&
 		   (return_to_userland ? !signal_pending(current) :
@@ -543,7 +543,7 @@  vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason)
 			 * and there's no need to retake the mmap_sem
 			 * in such case.
 			 */
-			mm_read_lock(mm);
+			mm_read_range_lock(mm, vmf->range);
 			ret = VM_FAULT_NOPAGE;
 		}
 	}