mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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
1e9877902d ("mm/gup: Introduce get_user_pages_remote()"), so this
appears to have been unintentional and reintroducing it is therefore not
an issue.
[[email protected]: coding-style fixes]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Lorenzo Stoakes <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Radim Krcmar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5b56d49fc3
commit
8b7457ef9a
6 changed files with 25 additions and 21 deletions
8
mm/gup.c
8
mm/gup.c
|
|
@ -865,9 +865,10 @@ EXPORT_SYMBOL(get_user_pages_locked);
|
|||
* caller if required (just like with __get_user_pages). "FOLL_GET"
|
||||
* is set implicitly if "pages" is non-NULL.
|
||||
*/
|
||||
__always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
|
||||
unsigned long start, unsigned long nr_pages,
|
||||
struct page **pages, unsigned int gup_flags)
|
||||
static __always_inline long __get_user_pages_unlocked(struct task_struct *tsk,
|
||||
struct mm_struct *mm, unsigned long start,
|
||||
unsigned long nr_pages, struct page **pages,
|
||||
unsigned int gup_flags)
|
||||
{
|
||||
long ret;
|
||||
int locked = 1;
|
||||
|
|
@ -879,7 +880,6 @@ __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct m
|
|||
up_read(&mm->mmap_sem);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(__get_user_pages_unlocked);
|
||||
|
||||
/*
|
||||
* get_user_pages_unlocked() is suitable to replace the form:
|
||||
|
|
|
|||
|
|
@ -176,9 +176,10 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
|
|||
}
|
||||
EXPORT_SYMBOL(get_user_pages_locked);
|
||||
|
||||
long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
|
||||
unsigned long start, unsigned long nr_pages,
|
||||
struct page **pages, unsigned int gup_flags)
|
||||
static long __get_user_pages_unlocked(struct task_struct *tsk,
|
||||
struct mm_struct *mm, unsigned long start,
|
||||
unsigned long nr_pages, struct page **pages,
|
||||
unsigned int gup_flags)
|
||||
{
|
||||
long ret;
|
||||
down_read(&mm->mmap_sem);
|
||||
|
|
@ -187,7 +188,6 @@ long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm,
|
|||
up_read(&mm->mmap_sem);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(__get_user_pages_unlocked);
|
||||
|
||||
long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
|
||||
struct page **pages, unsigned int gup_flags)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ static int process_vm_rw_single_vec(unsigned long addr,
|
|||
ssize_t rc = 0;
|
||||
unsigned long max_pages_per_loop = PVM_MAX_KMALLOC_PAGES
|
||||
/ sizeof(struct pages *);
|
||||
unsigned int flags = FOLL_REMOTE;
|
||||
unsigned int flags = 0;
|
||||
|
||||
/* Work out address and page range required */
|
||||
if (len == 0)
|
||||
|
|
@ -100,15 +100,19 @@ static int process_vm_rw_single_vec(unsigned long addr,
|
|||
|
||||
while (!rc && nr_pages && iov_iter_count(iter)) {
|
||||
int pages = min(nr_pages, max_pages_per_loop);
|
||||
int locked = 1;
|
||||
size_t bytes;
|
||||
|
||||
/*
|
||||
* Get the pages we're interested in. We must
|
||||
* add FOLL_REMOTE because task/mm might not
|
||||
* access remotely because task/mm might not
|
||||
* current/current->mm
|
||||
*/
|
||||
pages = __get_user_pages_unlocked(task, mm, pa, pages,
|
||||
process_pages, flags);
|
||||
down_read(&mm->mmap_sem);
|
||||
pages = get_user_pages_remote(task, mm, pa, pages, flags,
|
||||
process_pages, NULL, &locked);
|
||||
if (locked)
|
||||
up_read(&mm->mmap_sem);
|
||||
if (pages <= 0)
|
||||
return -EFAULT;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue