aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2015-02-11 18:27:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-11 20:06:05 -0500
commit0fd71a56f41d4ffabeda1dae9ff5ed4f34d4e935 (patch)
treebf1844624a69986ad308c298b894e1890977af91 /mm/nommu.c
parentf0818f472d8d527a96ec9cc2c3a56223497f9dd3 (diff)
mm: gup: add __get_user_pages_unlocked to customize gup_flags
Some callers (like KVM) may want to set the gup_flags like FOLL_HWPOSION to get a proper -EHWPOSION retval instead of -EFAULT to take a more appropriate action if get_user_pages runs into a memory failure. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Andres Lagar-Cavilla <andreslc@google.com> Cc: Peter Feiner <pfeiner@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index bfb690b0f986..4d1b8a199867 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -224,9 +224,10 @@ long get_user_pages_locked(struct task_struct *tsk, struct mm_struct *mm,
224} 224}
225EXPORT_SYMBOL(get_user_pages_locked); 225EXPORT_SYMBOL(get_user_pages_locked);
226 226
227long get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, 227long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
228 unsigned long start, unsigned long nr_pages, 228 unsigned long start, unsigned long nr_pages,
229 int write, int force, struct page **pages) 229 int write, int force, struct page **pages,
230 unsigned int gup_flags)
230{ 231{
231 long ret; 232 long ret;
232 down_read(&mm->mmap_sem); 233 down_read(&mm->mmap_sem);
@@ -235,6 +236,15 @@ long get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
235 up_read(&mm->mmap_sem); 236 up_read(&mm->mmap_sem);
236 return ret; 237 return ret;
237} 238}
239EXPORT_SYMBOL(__get_user_pages_unlocked);
240
241long get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
242 unsigned long start, unsigned long nr_pages,
243 int write, int force, struct page **pages)
244{
245 return __get_user_pages_unlocked(tsk, mm, start, nr_pages, write,
246 force, pages, 0);
247}
238EXPORT_SYMBOL(get_user_pages_unlocked); 248EXPORT_SYMBOL(get_user_pages_unlocked);
239 249
240/** 250/**