diff options
author | Lorenzo Stoakes <lstoakes@gmail.com> | 2016-12-14 18:06:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 19:04:09 -0500 |
commit | 8b7457ef9a9eb46cd1675d40d8e1fd3c47a38395 (patch) | |
tree | 485def76ab013b2609eb24762e4c39fc531c72d7 /mm/process_vm_access.c | |
parent | 5b56d49fc31dbb0487e14ead790fc81ca9fb2c99 (diff) |
mm: unexport __get_user_pages_unlocked()
Unexport the low-level __get_user_pages_unlocked() function and replaces
invocations with calls to more appropriate higher-level functions.
In hva_to_pfn_slow() we are able to replace __get_user_pages_unlocked()
with get_user_pages_unlocked() since we can now pass gup_flags.
In async_pf_execute() and process_vm_rw_single_vec() we need to pass
different tsk, mm arguments so get_user_pages_remote() is the sane
replacement in these cases (having added manual acquisition and release
of mmap_sem.)
Additionally get_user_pages_remote() reintroduces use of the FOLL_TOUCH
flag. However, this flag was originally silently dropped by commit
1e9877902dc7 ("mm/gup: Introduce get_user_pages_remote()"), so this
appears to have been unintentional and reintroducing it is therefore not
an issue.
[akpm@linux-foundation.org: coding-style fixes]
Link: http://lkml.kernel.org/r/20161027095141.2569-3-lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/process_vm_access.c')
-rw-r--r-- | mm/process_vm_access.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index be8dc8d1edb9..84d0c7eada2b 100644 --- a/mm/process_vm_access.c +++ b/mm/process_vm_access.c | |||
@@ -88,7 +88,7 @@ static int process_vm_rw_single_vec(unsigned long addr, | |||
88 | ssize_t rc = 0; | 88 | ssize_t rc = 0; |
89 | unsigned long max_pages_per_loop = PVM_MAX_KMALLOC_PAGES | 89 | unsigned long max_pages_per_loop = PVM_MAX_KMALLOC_PAGES |
90 | / sizeof(struct pages *); | 90 | / sizeof(struct pages *); |
91 | unsigned int flags = FOLL_REMOTE; | 91 | unsigned int flags = 0; |
92 | 92 | ||
93 | /* Work out address and page range required */ | 93 | /* Work out address and page range required */ |
94 | if (len == 0) | 94 | if (len == 0) |
@@ -100,15 +100,19 @@ static int process_vm_rw_single_vec(unsigned long addr, | |||
100 | 100 | ||
101 | while (!rc && nr_pages && iov_iter_count(iter)) { | 101 | while (!rc && nr_pages && iov_iter_count(iter)) { |
102 | int pages = min(nr_pages, max_pages_per_loop); | 102 | int pages = min(nr_pages, max_pages_per_loop); |
103 | int locked = 1; | ||
103 | size_t bytes; | 104 | size_t bytes; |
104 | 105 | ||
105 | /* | 106 | /* |
106 | * Get the pages we're interested in. We must | 107 | * Get the pages we're interested in. We must |
107 | * add FOLL_REMOTE because task/mm might not | 108 | * access remotely because task/mm might not |
108 | * current/current->mm | 109 | * current/current->mm |
109 | */ | 110 | */ |
110 | pages = __get_user_pages_unlocked(task, mm, pa, pages, | 111 | down_read(&mm->mmap_sem); |
111 | process_pages, flags); | 112 | pages = get_user_pages_remote(task, mm, pa, pages, flags, |
113 | process_pages, NULL, &locked); | ||
114 | if (locked) | ||
115 | up_read(&mm->mmap_sem); | ||
112 | if (pages <= 0) | 116 | if (pages <= 0) |
113 | return -EFAULT; | 117 | return -EFAULT; |
114 | 118 | ||