diff options
author | Lorenzo Stoakes <lstoakes@gmail.com> | 2016-10-24 05:57:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-24 22:13:20 -0400 |
commit | 0d7317598214134d73da59990b846481a9527a00 (patch) | |
tree | 2f72c1cdfd6c417a16d0697f50b9bdf909fc71fa /virt/kvm | |
parent | 272ddc8b37354c3fe111ab26d25e792629148eee (diff) |
mm: unexport __get_user_pages()
This patch unexports the low-level __get_user_pages() function.
Recent refactoring of the get_user_pages* functions allow flags to be
passed through get_user_pages() which eliminates the need for access to
this function from its one user, kvm.
We can see that the two calls to get_user_pages() which replace
__get_user_pages() in kvm_main.c are equivalent by examining their call
stacks:
get_user_page_nowait():
get_user_pages(start, 1, flags, page, NULL)
__get_user_pages_locked(current, current->mm, start, 1, page, NULL, NULL,
false, flags | FOLL_TOUCH)
__get_user_pages(current, current->mm, start, 1,
flags | FOLL_TOUCH | FOLL_GET, page, NULL, NULL)
check_user_page_hwpoison():
get_user_pages(addr, 1, flags, NULL, NULL)
__get_user_pages_locked(current, current->mm, addr, 1, NULL, NULL, NULL,
false, flags | FOLL_TOUCH)
__get_user_pages(current, current->mm, addr, 1, flags | FOLL_TOUCH, NULL,
NULL, NULL)
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/kvm_main.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 28510e72618a..2907b7b78654 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1346,21 +1346,19 @@ unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *w | |||
1346 | static int get_user_page_nowait(unsigned long start, int write, | 1346 | static int get_user_page_nowait(unsigned long start, int write, |
1347 | struct page **page) | 1347 | struct page **page) |
1348 | { | 1348 | { |
1349 | int flags = FOLL_TOUCH | FOLL_NOWAIT | FOLL_HWPOISON | FOLL_GET; | 1349 | int flags = FOLL_NOWAIT | FOLL_HWPOISON; |
1350 | 1350 | ||
1351 | if (write) | 1351 | if (write) |
1352 | flags |= FOLL_WRITE; | 1352 | flags |= FOLL_WRITE; |
1353 | 1353 | ||
1354 | return __get_user_pages(current, current->mm, start, 1, flags, page, | 1354 | return get_user_pages(start, 1, flags, page, NULL); |
1355 | NULL, NULL); | ||
1356 | } | 1355 | } |
1357 | 1356 | ||
1358 | static inline int check_user_page_hwpoison(unsigned long addr) | 1357 | static inline int check_user_page_hwpoison(unsigned long addr) |
1359 | { | 1358 | { |
1360 | int rc, flags = FOLL_TOUCH | FOLL_HWPOISON | FOLL_WRITE; | 1359 | int rc, flags = FOLL_HWPOISON | FOLL_WRITE; |
1361 | 1360 | ||
1362 | rc = __get_user_pages(current, current->mm, addr, 1, | 1361 | rc = get_user_pages(addr, 1, flags, NULL, NULL); |
1363 | flags, NULL, NULL, NULL); | ||
1364 | return rc == -EHWPOISON; | 1362 | return rc == -EHWPOISON; |
1365 | } | 1363 | } |
1366 | 1364 | ||