aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLorenzo Stoakes <lstoakes@gmail.com>2016-10-12 20:20:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-19 11:11:24 -0400
commit7f23b3504a0df63b724180262c5f3f117f21bcae (patch)
tree2cb724ea105ba582472261bda4450d32da1e67d4 /mm
parent3b913179c3fa89dd0e304193fa0c746fc0481447 (diff)
mm: replace get_vaddr_frames() write/force parameters with gup_flags
This removes the 'write' and 'force' from get_vaddr_frames() 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 <lstoakes@gmail.com> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/frame_vector.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/mm/frame_vector.c b/mm/frame_vector.c
index 81b67498bb9c..db77dcb38afd 100644
--- a/mm/frame_vector.c
+++ b/mm/frame_vector.c
@@ -11,10 +11,7 @@
11 * get_vaddr_frames() - map virtual addresses to pfns 11 * get_vaddr_frames() - map virtual addresses to pfns
12 * @start: starting user address 12 * @start: starting user address
13 * @nr_frames: number of pages / pfns from start to map 13 * @nr_frames: number of pages / pfns from start to map
14 * @write: whether pages will be written to by the caller 14 * @gup_flags: flags modifying lookup behaviour
15 * @force: whether to force write access even if user mapping is
16 * readonly. See description of the same argument of
17 get_user_pages().
18 * @vec: structure which receives pages / pfns of the addresses mapped. 15 * @vec: structure which receives pages / pfns of the addresses mapped.
19 * It should have space for at least nr_frames entries. 16 * It should have space for at least nr_frames entries.
20 * 17 *
@@ -34,23 +31,17 @@
34 * This function takes care of grabbing mmap_sem as necessary. 31 * This function takes care of grabbing mmap_sem as necessary.
35 */ 32 */
36int get_vaddr_frames(unsigned long start, unsigned int nr_frames, 33int get_vaddr_frames(unsigned long start, unsigned int nr_frames,
37 bool write, bool force, struct frame_vector *vec) 34 unsigned int gup_flags, struct frame_vector *vec)
38{ 35{
39 struct mm_struct *mm = current->mm; 36 struct mm_struct *mm = current->mm;
40 struct vm_area_struct *vma; 37 struct vm_area_struct *vma;
41 int ret = 0; 38 int ret = 0;
42 int err; 39 int err;
43 int locked; 40 int locked;
44 unsigned int gup_flags = 0;
45 41
46 if (nr_frames == 0) 42 if (nr_frames == 0)
47 return 0; 43 return 0;
48 44
49 if (write)
50 gup_flags |= FOLL_WRITE;
51 if (force)
52 gup_flags |= FOLL_FORCE;
53
54 if (WARN_ON_ONCE(nr_frames > vec->nr_allocated)) 45 if (WARN_ON_ONCE(nr_frames > vec->nr_allocated))
55 nr_frames = vec->nr_allocated; 46 nr_frames = vec->nr_allocated;
56 47