Skip to contentSkip to conversation

userfaultfd: hugetlbfs: gup: support VM_FAULT_RETRY

PATCH New [email protected] 1 participant 1 message Feb 22, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 69/142 userfaultfd: hugetlbfs: gup: support VM_FAULT_RETRY

From: Andrea Arcangeli <[email protected]>
Subject: userfaultfd: hugetlbfs: gup: support VM_FAULT_RETRY

Add support for VM_FAULT_RETRY to follow_hugetlb_page() so that get_user_pages_unlocked/locked and "nonblocking/FOLL_NOWAIT" features will work on hugetlbfs. This is required for fully functional userfaultfd non-present support on hugetlbfs.

---

 include/linux/hugetlb.h |    5 ++-
 mm/gup.c                |    2 -
 mm/hugetlb.c            |   48 +++++++++++++++++++++++++++++++-------
 3 files changed, 44 insertions(+), 11 deletions(-)
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~userfaultfd-hugetlbfs-gup-support-vm_fault_retry +3 -2
diff -puN include/linux/hugetlb.h~userfaultfd-hugetlbfs-gup-support-vm_fault_retry include/linux/hugetlb.h
@@ -65,7 +65,8 @@ int hugetlb_mempolicy_sysctl_handler(str
 int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
 long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
 			 struct page **, struct vm_area_struct **,
-			 unsigned long *, unsigned long *, long, unsigned int);
+			 unsigned long *, unsigned long *, long, unsigned int,
+			 int *);
 void unmap_hugepage_range(struct vm_area_struct *,
 			  unsigned long, unsigned long, struct page *);
 void __unmap_hugepage_range_final(struct mmu_gather *tlb,
@@ -136,7 +137,7 @@ static inline unsigned long hugetlb_tota
 	return 0;
 }
 
-#define follow_hugetlb_page(m,v,p,vs,a,b,i,w)	({ BUG(); 0; })
+#define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n)	({ BUG(); 0; })
 #define follow_huge_addr(mm, addr, write)	ERR_PTR(-EINVAL)
 #define copy_hugetlb_page_range(src, dst, vma)	({ BUG(); 0; })
 static inline void hugetlb_report_meminfo(struct seq_file *m)
mm/gup.c renamed from mm/gup.c~userfaultfd-hugetlbfs-gup-support-vm_fault_retry +1 -1
diff -puN mm/gup.c~userfaultfd-hugetlbfs-gup-support-vm_fault_retry mm/gup.c
@@ -572,7 +572,7 @@ static long __get_user_pages(struct task
 			if (is_vm_hugetlb_page(vma)) {
 				i = follow_hugetlb_page(mm, vma, pages, vmas,
 						&start, &nr_pages, i,
-						gup_flags);
+						gup_flags, nonblocking);
 				continue;
 			}
 		}
mm/hugetlb.c renamed from mm/hugetlb.c~userfaultfd-hugetlbfs-gup-support-vm_fault_retry +40 -8

69 lines not on this page · raw message

_