Skip to content

Commit 1ac2501

Browse files
aagittorvalds
authored andcommitted
mm/hugetlb.c: teach follow_hugetlb_page() to handle FOLL_NOWAIT
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]>
1 parent 36c0f7f commit 1ac2501

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/hugetlb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4268,7 +4268,8 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
42684268
break;
42694269
}
42704270
if (ret & VM_FAULT_RETRY) {
4271-
if (nonblocking)
4271+
if (nonblocking &&
4272+
!(fault_flags & FAULT_FLAG_RETRY_NOWAIT))
42724273
*nonblocking = 0;
42734274
*nr_pages = 0;
42744275
/*

0 commit comments

Comments
 (0)