mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
mm: replace get_user_pages_remote() write/force parameters with gup_flags
This removes the 'write' and 'force' from get_user_pages_remote() and replaces them with 'gup_flags' to make the use of FOLL_FORCE explicit in callers as use of this flag can result in surprising behaviour (and hence bugs) within the mm subsystem. Signed-off-by: Lorenzo Stoakes <[email protected]> Acked-by: Michal Hocko <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
768ae309a9
commit
9beae1ea89
9 changed files with 40 additions and 27 deletions
22
mm/gup.c
22
mm/gup.c
|
|
@ -915,9 +915,7 @@ EXPORT_SYMBOL(get_user_pages_unlocked);
|
|||
* @mm: mm_struct of target mm
|
||||
* @start: starting user address
|
||||
* @nr_pages: number of pages from start to pin
|
||||
* @write: whether pages will be written to by the caller
|
||||
* @force: whether to force access even when user mapping is currently
|
||||
* protected (but never forces write access to shared mapping).
|
||||
* @gup_flags: flags modifying lookup behaviour
|
||||
* @pages: array that receives pointers to the pages pinned.
|
||||
* Should be at least nr_pages long. Or NULL, if caller
|
||||
* only intends to ensure the pages are faulted in.
|
||||
|
|
@ -946,9 +944,9 @@ EXPORT_SYMBOL(get_user_pages_unlocked);
|
|||
* or similar operation cannot guarantee anything stronger anyway because
|
||||
* locks can't be held over the syscall boundary.
|
||||
*
|
||||
* If write=0, the page must not be written to. If the page is written to,
|
||||
* set_page_dirty (or set_page_dirty_lock, as appropriate) must be called
|
||||
* after the page is finished with, and before put_page is called.
|
||||
* If gup_flags & FOLL_WRITE == 0, the page must not be written to. If the page
|
||||
* is written to, set_page_dirty (or set_page_dirty_lock, as appropriate) must
|
||||
* be called after the page is finished with, and before put_page is called.
|
||||
*
|
||||
* get_user_pages is typically used for fewer-copy IO operations, to get a
|
||||
* handle on the memory by some means other than accesses via the user virtual
|
||||
|
|
@ -965,18 +963,12 @@ 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,
|
||||
int write, int force, struct page **pages,
|
||||
unsigned int gup_flags, struct page **pages,
|
||||
struct vm_area_struct **vmas)
|
||||
{
|
||||
unsigned int flags = FOLL_TOUCH | FOLL_REMOTE;
|
||||
|
||||
if (write)
|
||||
flags |= FOLL_WRITE;
|
||||
if (force)
|
||||
flags |= FOLL_FORCE;
|
||||
|
||||
return __get_user_pages_locked(tsk, mm, start, nr_pages, pages, vmas,
|
||||
NULL, false, flags);
|
||||
NULL, false,
|
||||
gup_flags | FOLL_TOUCH | FOLL_REMOTE);
|
||||
}
|
||||
EXPORT_SYMBOL(get_user_pages_remote);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue