mm/hugetlb.c: teach follow_hugetlb_page() to handle FOLL_NOWAIT
Subsystems (3)
[email protected]
maintainerPATCH 4/24 mm/hugetlb.c: teach follow_hugetlb_page() to handle FOLL_NOWAIT
From: Andrea Arcangeli <[email protected]>
Subject: mm/hugetlb.c: teach follow_hugetlb_page() to handle FOLL_NOWAIT
hugetlb needs the same fix as faultin_nopage (which was applied in 96312e61282ae ("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.
Fixes ce53053ce378 ("kvm: switch get_user_page_nowait() to get_user_pages_unlocked()")
Signed-off-by Andrea Arcangeli <[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]>
---
mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlbc-teach-follow_hugetlb_page-to-handle-foll_nowait +2 -1
@@ -4268,7 +4268,8 @@ long follow_hugetlb_page(struct mm_strucbreak ; }if (ret &VM_FAULT_RETRY ) { -if (nonblocking) +if (nonblocking && + !(fault_flags &FAULT_FLAG_RETRY_NOWAIT )) *nonblocking =0 ; *nr_pages =0 ;/*
_