Skip to content

Commit

Permalink
mm/hugetlb.c: teach follow_hugetlb_page() to handle FOLL_NOWAIT
Browse files Browse the repository at this point in the history
hugetlb needs the same fix as faultin_nopage (which was applied in
commit 96312e6 ("mm/gup.c: teach get_user_pages_unlocked to handle
FOLL_NOWAIT")) or KVM hangs because it thinks the mmap_sem was already
released by hugetlb_fault() if it returned VM_FAULT_RETRY, but it wasn't
in the FOLL_NOWAIT case.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: ce53053 ("kvm: switch get_user_page_nowait() to get_user_pages_unlocked()")
Signed-off-by: Andrea Arcangeli <[email protected]>
Tested-by: "Dr. David Alan Gilbert" <[email protected]>
Reported-by: "Dr. David Alan Gilbert" <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
aagit authored and torvalds committed Feb 1, 2019
1 parent 36c0f7f commit 1ac2501
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4268,7 +4268,8 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
break;
}
if (ret & VM_FAULT_RETRY) {
if (nonblocking)
if (nonblocking &&
!(fault_flags & FAULT_FLAG_RETRY_NOWAIT))
*nonblocking = 0;
*nr_pages = 0;
/*
Expand Down

0 comments on commit 1ac2501

Please sign in to comment.