Skip to content

Commit ef429ee

Browse files
xzpetertorvalds
authored andcommitted
userfaultfd: don't retake mmap_sem to emulate NOPAGE
This patch removes the risk path in handle_userfault() then we will be sure that the callers of handle_mm_fault() will know that the VMAs might have changed. Meanwhile with previous patch we don't lose responsiveness as well since the core mm code now can handle the nonfatal userspace signals even if we return VM_FAULT_RETRY. Suggested-by: Andrea Arcangeli <[email protected]> Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Tested-by: Brian Geffon <[email protected]> Reviewed-by: Jerome Glisse <[email protected]> Cc: Bobby Powers <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Denis Plotnikov <[email protected]> Cc: "Dr . David Alan Gilbert" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: "Kirill A . Shutemov" <[email protected]> Cc: Martin Cracauer <[email protected]> Cc: Marty McFadden <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Maya Gokhale <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Pavel Emelyanov <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8b9a65f commit ef429ee

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

fs/userfaultfd.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -524,30 +524,6 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason)
524524

525525
__set_current_state(TASK_RUNNING);
526526

527-
if (return_to_userland) {
528-
if (signal_pending(current) &&
529-
!fatal_signal_pending(current)) {
530-
/*
531-
* If we got a SIGSTOP or SIGCONT and this is
532-
* a normal userland page fault, just let
533-
* userland return so the signal will be
534-
* handled and gdb debugging works. The page
535-
* fault code immediately after we return from
536-
* this function is going to release the
537-
* mmap_sem and it's not depending on it
538-
* (unlike gup would if we were not to return
539-
* VM_FAULT_RETRY).
540-
*
541-
* If a fatal signal is pending we still take
542-
* the streamlined VM_FAULT_RETRY failure path
543-
* and there's no need to retake the mmap_sem
544-
* in such case.
545-
*/
546-
down_read(&mm->mmap_sem);
547-
ret = VM_FAULT_NOPAGE;
548-
}
549-
}
550-
551527
/*
552528
* Here we race with the list_del; list_add in
553529
* userfaultfd_ctx_read(), however because we don't ever run

0 commit comments

Comments
 (0)