mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mm: add locked parameter to get_user_pages_remote()
Patch series "mm: unexport __get_user_pages_unlocked()". This patch series continues the cleanup of get_user_pages*() functions taking advantage of the fact we can now pass gup_flags as we please. It firstly adds an additional 'locked' parameter to get_user_pages_remote() to allow for its callers to utilise VM_FAULT_RETRY functionality. This is necessary as the invocation of __get_user_pages_unlocked() in process_vm_rw_single_vec() makes use of this and no other existing higher level function would allow it to do so. Secondly existing callers of __get_user_pages_unlocked() are replaced with the appropriate higher-level replacement - get_user_pages_unlocked() if the current task and memory descriptor are referenced, or get_user_pages_remote() if other task/memory descriptors are referenced (having acquiring mmap_sem.) This patch (of 2): Add a int *locked parameter to get_user_pages_remote() to allow VM_FAULT_RETRY faulting behaviour similar to get_user_pages_[un]locked(). Taking into account the previous adjustments to get_user_pages*() functions allowing for the passing of gup_flags, we are now in a position where __get_user_pages_unlocked() need only be exported for his ability to allow VM_FAULT_RETRY behaviour, this adjustment allows us to subsequently unexport __get_user_pages_unlocked() as well as allowing for future flexibility in the use of get_user_pages_remote(). [[email protected]: merge fix for get_user_pages_remote API change] Link: http://lkml.kernel.org/r/[email protected] 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: Stephen Rothwell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
370b262c89
commit
5b56d49fc3
10 changed files with 18 additions and 14 deletions
12
mm/gup.c
12
mm/gup.c
|
|
@ -917,6 +917,9 @@ EXPORT_SYMBOL(get_user_pages_unlocked);
|
|||
* only intends to ensure the pages are faulted in.
|
||||
* @vmas: array of pointers to vmas corresponding to each page.
|
||||
* Or NULL if the caller does not require them.
|
||||
* @locked: pointer to lock flag indicating whether lock is held and
|
||||
* subsequently whether VM_FAULT_RETRY functionality can be
|
||||
* utilised. Lock must initially be held.
|
||||
*
|
||||
* Returns number of pages pinned. This may be fewer than the number
|
||||
* requested. If nr_pages is 0 or negative, returns 0. If no pages
|
||||
|
|
@ -960,10 +963,10 @@ EXPORT_SYMBOL(get_user_pages_unlocked);
|
|||
long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
|
||||
unsigned long start, unsigned long nr_pages,
|
||||
unsigned int gup_flags, struct page **pages,
|
||||
struct vm_area_struct **vmas)
|
||||
struct vm_area_struct **vmas, int *locked)
|
||||
{
|
||||
return __get_user_pages_locked(tsk, mm, start, nr_pages, pages, vmas,
|
||||
NULL, false,
|
||||
locked, true,
|
||||
gup_flags | FOLL_TOUCH | FOLL_REMOTE);
|
||||
}
|
||||
EXPORT_SYMBOL(get_user_pages_remote);
|
||||
|
|
@ -971,8 +974,9 @@ EXPORT_SYMBOL(get_user_pages_remote);
|
|||
/*
|
||||
* This is the same as get_user_pages_remote(), just with a
|
||||
* less-flexible calling convention where we assume that the task
|
||||
* and mm being operated on are the current task's. We also
|
||||
* obviously don't pass FOLL_REMOTE in here.
|
||||
* and mm being operated on are the current task's and don't allow
|
||||
* passing of a locked parameter. We also obviously don't pass
|
||||
* FOLL_REMOTE in here.
|
||||
*/
|
||||
long get_user_pages(unsigned long start, unsigned long nr_pages,
|
||||
unsigned int gup_flags, struct page **pages,
|
||||
|
|
|
|||
Loading…
Reference in a new issue