mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
272ddc8b37
commit
0d73175982
4 changed files with 6 additions and 13 deletions
|
|
@ -1346,21 +1346,19 @@ unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *w
|
|||
static int get_user_page_nowait(unsigned long start, int write,
|
||||
struct page **page)
|
||||
{
|
||||
int flags = FOLL_TOUCH | FOLL_NOWAIT | FOLL_HWPOISON | FOLL_GET;
|
||||
int flags = FOLL_NOWAIT | FOLL_HWPOISON;
|
||||
|
||||
if (write)
|
||||
flags |= FOLL_WRITE;
|
||||
|
||||
return __get_user_pages(current, current->mm, start, 1, flags, page,
|
||||
NULL, NULL);
|
||||
return get_user_pages(start, 1, flags, page, NULL);
|
||||
}
|
||||
|
||||
static inline int check_user_page_hwpoison(unsigned long addr)
|
||||
{
|
||||
int rc, flags = FOLL_TOUCH | FOLL_HWPOISON | FOLL_WRITE;
|
||||
int rc, flags = FOLL_HWPOISON | FOLL_WRITE;
|
||||
|
||||
rc = __get_user_pages(current, current->mm, addr, 1,
|
||||
flags, NULL, NULL, NULL);
|
||||
rc = get_user_pages(addr, 1, flags, NULL, NULL);
|
||||
return rc == -EHWPOISON;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue