@@ -1537,9 +1537,21 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
struct page **pages, unsigned int gup_flags);
#ifdef CONFIG_FS_DAX
-long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
- unsigned int gup_flags, struct page **pages,
- struct vm_area_struct **vmas);
+long get_user_pages_remote_longterm(struct task_struct *tsk,
+ struct mm_struct *mm, unsigned long start,
+ unsigned long nr_pages, unsigned int gup_flags,
+ struct page **pages, struct vm_area_struct **vmas);
+
+static inline long get_user_pages_longterm(unsigned long start,
+ unsigned long nr_pages,
+ unsigned int gup_flags,
+ struct page **pages,
+ struct vm_area_struct **vmas)
+{
+ return get_user_pages_remote_longterm(current, current->mm, start,
+ nr_pages, gup_flags, pages,
+ vmas);
+}
#else
static inline long get_user_pages_longterm(unsigned long start,
unsigned long nr_pages, unsigned int gup_flags,
@@ -1547,6 +1559,16 @@ static inline long get_user_pages_longterm(unsigned long start,
{
return get_user_pages(start, nr_pages, gup_flags, pages, vmas);
}
+
+static inline long get_user_pages_remote_longterm(struct task_struct *tsk,
+ struct mm_struct *mm, unsigned long start,
+ unsigned long nr_pages, unsigned int gup_flags,
+ struct page **pages, struct vm_area_struct **vmas)
+{
+ return get_user_pages_remote(tsk, mm, start, nr_pages,
+ gup_flags, pages, vmas);
+}
+
#endif /* CONFIG_FS_DAX */
int get_user_pages_fast(unsigned long start, int nr_pages, int write,
@@ -1139,9 +1139,11 @@ EXPORT_SYMBOL(get_user_pages);
* "longterm" == userspace controlled elevated page count lifetime.
* Contrast this to iov_iter_get_pages() usages which are transient.
*/
-long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
- unsigned int gup_flags, struct page **pages,
- struct vm_area_struct **vmas_arg)
+long get_user_pages_remote_longterm(struct task_struct *tsk,
+ struct mm_struct *mm, unsigned long start,
+ unsigned long nr_pages, unsigned int gup_flags,
+ struct page **pages,
+ struct vm_area_struct **vmas_arg)
{
struct vm_area_struct **vmas = vmas_arg;
struct vm_area_struct *vma_prev = NULL;
@@ -1157,7 +1159,9 @@ long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
return -ENOMEM;
}
- rc = get_user_pages(start, nr_pages, gup_flags, pages, vmas);
+ rc = __get_user_pages_locked(tsk, mm, start, nr_pages,
+ pages, vmas, NULL,
+ gup_flags | FOLL_TOUCH | FOLL_REMOTE);
for (i = 0; i < rc; i++) {
struct vm_area_struct *vma = vmas[i];
@@ -1187,7 +1191,8 @@ long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
kfree(vmas);
return rc;
}
-EXPORT_SYMBOL(get_user_pages_longterm);
+EXPORT_SYMBOL(get_user_pages_remote_longterm);
+
#endif /* CONFIG_FS_DAX */
/**