All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lstoakes@gmail.com>
To: linux-mm@kvack.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	adi-buildroot-devel@lists.sourceforge.net,
	ceph-devel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org,
	linux-alpha@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-cris-kernel@axis.com,
	linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-mips@linux-mips.org,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-sh@vger.kerne
Subject: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()
Date: Thu, 13 Oct 2016 01:20:11 +0100	[thread overview]
Message-ID: <20161013002020.3062-2-lstoakes@gmail.com> (raw)
In-Reply-To: <20161013002020.3062-1-lstoakes@gmail.com>

This patch removes the write and force parameters from __get_user_pages_locked()
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>
---
 mm/gup.c | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 96b2b2f..ba83942 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -729,7 +729,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 						struct mm_struct *mm,
 						unsigned long start,
 						unsigned long nr_pages,
-						int write, int force,
 						struct page **pages,
 						struct vm_area_struct **vmas,
 						int *locked, bool notify_drop,
@@ -747,10 +746,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 
 	if (pages)
 		flags |= FOLL_GET;
-	if (write)
-		flags |= FOLL_WRITE;
-	if (force)
-		flags |= FOLL_FORCE;
 
 	pages_done = 0;
 	lock_dropped = false;
@@ -846,9 +841,15 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
 			   int write, int force, struct page **pages,
 			   int *locked)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, NULL, locked, true,
-				       FOLL_TOUCH);
+				       pages, NULL, locked, true, flags);
 }
 EXPORT_SYMBOL(get_user_pages_locked);
 
@@ -869,9 +870,15 @@ __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct m
 {
 	long ret;
 	int locked = 1;
+
+	if (write)
+		gup_flags |= FOLL_WRITE;
+	if (force)
+		gup_flags |= FOLL_FORCE;
+
 	down_read(&mm->mmap_sem);
-	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				      pages, NULL, &locked, false, gup_flags);
+	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
+				      &locked, false, gup_flags);
 	if (locked)
 		up_read(&mm->mmap_sem);
 	return ret;
@@ -963,9 +970,15 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
-	return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				       pages, vmas, NULL, false,
-				       FOLL_TOUCH | FOLL_REMOTE);
+	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);
 }
 EXPORT_SYMBOL(get_user_pages_remote);
 
@@ -979,9 +992,15 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, vmas, NULL, false,
-				       FOLL_TOUCH);
+				       pages, vmas, NULL, false, flags);
 }
 EXPORT_SYMBOL(get_user_pages);
 
-- 
2.10.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Stoakes <lstoakes@gmail.com>
To: linux-mm@kvack.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	adi-buildroot-devel@lists.sourceforge.net,
	ceph-devel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org,
	linux-alpha@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-cris-kernel@axis.com,
	linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-mips@linux-mips.org,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-sh@vger.kerne
Subject: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()
Date: Thu, 13 Oct 2016 00:20:11 +0000	[thread overview]
Message-ID: <20161013002020.3062-2-lstoakes@gmail.com> (raw)
In-Reply-To: <20161013002020.3062-1-lstoakes@gmail.com>

This patch removes the write and force parameters from __get_user_pages_locked()
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>
---
 mm/gup.c | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 96b2b2f..ba83942 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -729,7 +729,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 						struct mm_struct *mm,
 						unsigned long start,
 						unsigned long nr_pages,
-						int write, int force,
 						struct page **pages,
 						struct vm_area_struct **vmas,
 						int *locked, bool notify_drop,
@@ -747,10 +746,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 
 	if (pages)
 		flags |= FOLL_GET;
-	if (write)
-		flags |= FOLL_WRITE;
-	if (force)
-		flags |= FOLL_FORCE;
 
 	pages_done = 0;
 	lock_dropped = false;
@@ -846,9 +841,15 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
 			   int write, int force, struct page **pages,
 			   int *locked)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, NULL, locked, true,
-				       FOLL_TOUCH);
+				       pages, NULL, locked, true, flags);
 }
 EXPORT_SYMBOL(get_user_pages_locked);
 
@@ -869,9 +870,15 @@ __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct m
 {
 	long ret;
 	int locked = 1;
+
+	if (write)
+		gup_flags |= FOLL_WRITE;
+	if (force)
+		gup_flags |= FOLL_FORCE;
+
 	down_read(&mm->mmap_sem);
-	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				      pages, NULL, &locked, false, gup_flags);
+	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
+				      &locked, false, gup_flags);
 	if (locked)
 		up_read(&mm->mmap_sem);
 	return ret;
@@ -963,9 +970,15 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
-	return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				       pages, vmas, NULL, false,
-				       FOLL_TOUCH | FOLL_REMOTE);
+	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);
 }
 EXPORT_SYMBOL(get_user_pages_remote);
 
@@ -979,9 +992,15 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, vmas, NULL, false,
-				       FOLL_TOUCH);
+				       pages, vmas, NULL, false, flags);
 }
 EXPORT_SYMBOL(get_user_pages);
 
-- 
2.10.0


WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Stoakes <lstoakes@gmail.com>
To: linux-mm@kvack.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	adi-buildroot-devel@lists.sourceforge.net,
	ceph-devel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org,
	linux-alpha@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-cris-kernel@axis.com,
	linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-mips@linux-mips.org,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-sh@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
	sparclinux@vger.kernel.org, x86@kernel.org,
	Lorenzo Stoakes <lstoakes@gmail.com>
Subject: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()
Date: Thu, 13 Oct 2016 01:20:11 +0100	[thread overview]
Message-ID: <20161013002020.3062-2-lstoakes@gmail.com> (raw)
In-Reply-To: <20161013002020.3062-1-lstoakes@gmail.com>

This patch removes the write and force parameters from __get_user_pages_locked()
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>
---
 mm/gup.c | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 96b2b2f..ba83942 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -729,7 +729,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 						struct mm_struct *mm,
 						unsigned long start,
 						unsigned long nr_pages,
-						int write, int force,
 						struct page **pages,
 						struct vm_area_struct **vmas,
 						int *locked, bool notify_drop,
@@ -747,10 +746,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 
 	if (pages)
 		flags |= FOLL_GET;
-	if (write)
-		flags |= FOLL_WRITE;
-	if (force)
-		flags |= FOLL_FORCE;
 
 	pages_done = 0;
 	lock_dropped = false;
@@ -846,9 +841,15 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
 			   int write, int force, struct page **pages,
 			   int *locked)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, NULL, locked, true,
-				       FOLL_TOUCH);
+				       pages, NULL, locked, true, flags);
 }
 EXPORT_SYMBOL(get_user_pages_locked);
 
@@ -869,9 +870,15 @@ __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct m
 {
 	long ret;
 	int locked = 1;
+
+	if (write)
+		gup_flags |= FOLL_WRITE;
+	if (force)
+		gup_flags |= FOLL_FORCE;
+
 	down_read(&mm->mmap_sem);
-	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				      pages, NULL, &locked, false, gup_flags);
+	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
+				      &locked, false, gup_flags);
 	if (locked)
 		up_read(&mm->mmap_sem);
 	return ret;
@@ -963,9 +970,15 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
-	return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				       pages, vmas, NULL, false,
-				       FOLL_TOUCH | FOLL_REMOTE);
+	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);
 }
 EXPORT_SYMBOL(get_user_pages_remote);
 
@@ -979,9 +992,15 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, vmas, NULL, false,
-				       FOLL_TOUCH);
+				       pages, vmas, NULL, false, flags);
 }
 EXPORT_SYMBOL(get_user_pages);
 
-- 
2.10.0

WARNING: multiple messages have this Message-ID (diff)
From: lstoakes@gmail.com (Lorenzo Stoakes)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()
Date: Thu, 13 Oct 2016 01:20:11 +0100	[thread overview]
Message-ID: <20161013002020.3062-2-lstoakes@gmail.com> (raw)
In-Reply-To: <20161013002020.3062-1-lstoakes@gmail.com>

This patch removes the write and force parameters from __get_user_pages_locked()
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>
---
 mm/gup.c | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 96b2b2f..ba83942 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -729,7 +729,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 						struct mm_struct *mm,
 						unsigned long start,
 						unsigned long nr_pages,
-						int write, int force,
 						struct page **pages,
 						struct vm_area_struct **vmas,
 						int *locked, bool notify_drop,
@@ -747,10 +746,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 
 	if (pages)
 		flags |= FOLL_GET;
-	if (write)
-		flags |= FOLL_WRITE;
-	if (force)
-		flags |= FOLL_FORCE;
 
 	pages_done = 0;
 	lock_dropped = false;
@@ -846,9 +841,15 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
 			   int write, int force, struct page **pages,
 			   int *locked)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, NULL, locked, true,
-				       FOLL_TOUCH);
+				       pages, NULL, locked, true, flags);
 }
 EXPORT_SYMBOL(get_user_pages_locked);
 
@@ -869,9 +870,15 @@ __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct m
 {
 	long ret;
 	int locked = 1;
+
+	if (write)
+		gup_flags |= FOLL_WRITE;
+	if (force)
+		gup_flags |= FOLL_FORCE;
+
 	down_read(&mm->mmap_sem);
-	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				      pages, NULL, &locked, false, gup_flags);
+	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
+				      &locked, false, gup_flags);
 	if (locked)
 		up_read(&mm->mmap_sem);
 	return ret;
@@ -963,9 +970,15 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
-	return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				       pages, vmas, NULL, false,
-				       FOLL_TOUCH | FOLL_REMOTE);
+	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);
 }
 EXPORT_SYMBOL(get_user_pages_remote);
 
@@ -979,9 +992,15 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, vmas, NULL, false,
-				       FOLL_TOUCH);
+				       pages, vmas, NULL, false, flags);
 }
 EXPORT_SYMBOL(get_user_pages);
 
-- 
2.10.0

WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Stoakes <lstoakes@gmail.com>
To: linux-mm@kvack.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Rik van Riel <riel@redhat.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	adi-buildroot-devel@lists.sourceforge.net,
	ceph-devel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, kvm@vger.kernel.org,
	linux-alpha@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-cris-kernel@axis.com,
	linux-fbdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linux-mips@linux-mips.org,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-security-module@vger.kernel.org, linux-sh@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
	sparclinux@vger.kernel.org, x86@kernel.org,
	Lorenzo Stoakes <lstoakes@gmail.com>
Subject: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()
Date: Thu, 13 Oct 2016 01:20:11 +0100	[thread overview]
Message-ID: <20161013002020.3062-2-lstoakes@gmail.com> (raw)
In-Reply-To: <20161013002020.3062-1-lstoakes@gmail.com>

This patch removes the write and force parameters from __get_user_pages_locked()
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>
---
 mm/gup.c | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 96b2b2f..ba83942 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -729,7 +729,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 						struct mm_struct *mm,
 						unsigned long start,
 						unsigned long nr_pages,
-						int write, int force,
 						struct page **pages,
 						struct vm_area_struct **vmas,
 						int *locked, bool notify_drop,
@@ -747,10 +746,6 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
 
 	if (pages)
 		flags |= FOLL_GET;
-	if (write)
-		flags |= FOLL_WRITE;
-	if (force)
-		flags |= FOLL_FORCE;
 
 	pages_done = 0;
 	lock_dropped = false;
@@ -846,9 +841,15 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
 			   int write, int force, struct page **pages,
 			   int *locked)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, NULL, locked, true,
-				       FOLL_TOUCH);
+				       pages, NULL, locked, true, flags);
 }
 EXPORT_SYMBOL(get_user_pages_locked);
 
@@ -869,9 +870,15 @@ __always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct m
 {
 	long ret;
 	int locked = 1;
+
+	if (write)
+		gup_flags |= FOLL_WRITE;
+	if (force)
+		gup_flags |= FOLL_FORCE;
+
 	down_read(&mm->mmap_sem);
-	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				      pages, NULL, &locked, false, gup_flags);
+	ret = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, NULL,
+				      &locked, false, gup_flags);
 	if (locked)
 		up_read(&mm->mmap_sem);
 	return ret;
@@ -963,9 +970,15 @@ long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
-	return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
-				       pages, vmas, NULL, false,
-				       FOLL_TOUCH | FOLL_REMOTE);
+	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);
 }
 EXPORT_SYMBOL(get_user_pages_remote);
 
@@ -979,9 +992,15 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
 		int write, int force, struct page **pages,
 		struct vm_area_struct **vmas)
 {
+	unsigned int flags = FOLL_TOUCH;
+
+	if (write)
+		flags |= FOLL_WRITE;
+	if (force)
+		flags |= FOLL_FORCE;
+
 	return __get_user_pages_locked(current, current->mm, start, nr_pages,
-				       write, force, pages, vmas, NULL, false,
-				       FOLL_TOUCH);
+				       pages, vmas, NULL, false, flags);
 }
 EXPORT_SYMBOL(get_user_pages);
 
-- 
2.10.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-10-13  0:20 UTC|newest]

Thread overview: 226+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  0:20 [PATCH 00/10] mm: adjust get_user_pages* functions to explicitly pass FOLL_* flags Lorenzo Stoakes
2016-10-13  0:20 ` Lorenzo Stoakes
2016-10-13  0:20 ` Lorenzo Stoakes
2016-10-13  0:20 ` Lorenzo Stoakes
2016-10-13  0:20 ` Lorenzo Stoakes
2016-10-13  0:20 ` Lorenzo Stoakes [this message]
2016-10-13  0:20   ` [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked() Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-18 12:43   ` Jan Kara
2016-10-18 12:43     ` Jan Kara
2016-10-18 12:43     ` Jan Kara
2016-10-18 12:43     ` Jan Kara
2016-10-18 12:43     ` Jan Kara
2016-10-18 12:43     ` Jan Kara
2016-10-13  0:20 ` [PATCH 02/10] mm: remove write/force parameters from __get_user_pages_unlocked() Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  6:54   ` Paolo Bonzini
2016-10-13  6:54     ` Paolo Bonzini
2016-10-13  6:54     ` Paolo Bonzini
2016-10-13  6:54     ` Paolo Bonzini
2016-10-13  6:54     ` Paolo Bonzini
2016-10-18 12:46   ` Jan Kara
2016-10-18 12:46     ` Jan Kara
2016-10-18 12:46     ` Jan Kara
2016-10-18 12:46     ` Jan Kara
2016-10-18 12:46     ` Jan Kara
2016-10-18 12:46     ` Jan Kara
2016-10-13  0:20 ` [PATCH 03/10] mm: replace get_user_pages_unlocked() write/force parameters with gup_flags Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-18 12:50   ` Jan Kara
2016-10-18 12:50     ` Jan Kara
2016-10-18 12:50     ` Jan Kara
2016-10-18 12:50     ` Jan Kara
2016-10-18 12:50     ` Jan Kara
2016-10-18 12:50     ` Jan Kara
2016-10-13  0:20 ` [PATCH 04/10] mm: replace get_user_pages_locked() " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-18 12:54   ` Jan Kara
2016-10-18 12:54     ` Jan Kara
2016-10-18 12:54     ` Jan Kara
2016-10-18 12:54     ` Jan Kara
2016-10-18 12:54     ` Jan Kara
2016-10-18 12:54     ` Jan Kara
2016-10-18 13:56     ` Lorenzo Stoakes
2016-10-18 13:56       ` Lorenzo Stoakes
2016-10-18 13:56       ` Lorenzo Stoakes
2016-10-18 13:56       ` Lorenzo Stoakes
2016-10-18 13:56       ` Lorenzo Stoakes
2016-10-18 13:56       ` Lorenzo Stoakes
2016-10-19  7:32       ` Jan Kara
2016-10-19  7:32         ` Jan Kara
2016-10-19  7:32         ` Jan Kara
2016-10-19  7:32         ` Jan Kara
2016-10-19  7:32         ` Jan Kara
2016-10-19  7:33   ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-19  7:33     ` Jan Kara
2016-10-13  0:20 ` [PATCH 05/10] mm: replace get_vaddr_frames() " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-19  7:34   ` Jan Kara
2016-10-19  7:34     ` Jan Kara
2016-10-19  7:34     ` Jan Kara
2016-10-19  7:34     ` Jan Kara
2016-10-19  7:34     ` Jan Kara
2016-10-19  7:34     ` Jan Kara
2016-10-13  0:20 ` [PATCH 06/10] mm: replace get_user_pages() " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-17  9:22   ` Jesper Nilsson
2016-10-17  9:22     ` Jesper Nilsson
2016-10-17  9:22     ` Jesper Nilsson
2016-10-17  9:22     ` Jesper Nilsson
2016-10-17  9:22     ` Jesper Nilsson
2016-10-17  9:22     ` Jesper Nilsson
2016-10-19  7:44   ` Jan Kara
2016-10-19  7:44     ` Jan Kara
2016-10-19  7:44     ` Jan Kara
2016-10-19  7:44     ` Jan Kara
2016-10-19  7:44     ` Jan Kara
2016-10-19  7:44     ` Jan Kara
2016-10-13  0:20 ` [PATCH 07/10] mm: replace get_user_pages_remote() " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-19  7:47   ` Jan Kara
2016-10-19  7:47     ` Jan Kara
2016-10-19  7:47     ` Jan Kara
2016-10-19  7:47     ` Jan Kara
2016-10-19  7:47     ` Jan Kara
2016-10-19  7:47     ` Jan Kara
2016-10-13  0:20 ` [PATCH 08/10] mm: replace __access_remote_vm() write parameter " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-19  7:59   ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  7:59     ` Jan Kara
2016-10-19  8:13     ` Michal Hocko
2016-10-19  8:13       ` Michal Hocko
2016-10-19  8:13       ` Michal Hocko
2016-10-19  8:13       ` Michal Hocko
2016-10-19  8:13       ` Michal Hocko
2016-10-19  8:40       ` Lorenzo Stoakes
2016-10-19  8:40         ` Lorenzo Stoakes
2016-10-19  8:40         ` Lorenzo Stoakes
2016-10-19  8:40         ` Lorenzo Stoakes
2016-10-19  8:40         ` Lorenzo Stoakes
2016-10-19  8:52         ` Michal Hocko
2016-10-19  8:52           ` Michal Hocko
2016-10-19  8:52           ` Michal Hocko
2016-10-19  8:52           ` Michal Hocko
2016-10-19  8:52           ` Michal Hocko
2016-10-19  9:06           ` Lorenzo Stoakes
2016-10-19  9:06             ` Lorenzo Stoakes
2016-10-19  9:06             ` Lorenzo Stoakes
2016-10-19  9:06             ` Lorenzo Stoakes
2016-10-19  9:06             ` Lorenzo Stoakes
2016-10-19  9:23             ` Michal Hocko
2016-10-19  9:23               ` Michal Hocko
2016-10-19  9:23               ` Michal Hocko
2016-10-19  9:23               ` Michal Hocko
2016-10-19  9:23               ` Michal Hocko
2016-10-13  0:20 ` [PATCH 09/10] mm: replace access_remote_vm() " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20 ` [PATCH 10/10] mm: replace access_process_vm() " Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-13  0:20   ` Lorenzo Stoakes
2016-10-17  9:23   ` Jesper Nilsson
2016-10-17  9:23     ` Jesper Nilsson
2016-10-17  9:23     ` Jesper Nilsson
2016-10-17  9:23     ` Jesper Nilsson
2016-10-17  9:23     ` Jesper Nilsson
2016-10-17  9:23     ` Jesper Nilsson
2016-10-19 11:10   ` Michael Ellerman
2016-10-19 11:10     ` Michael Ellerman
2016-10-19 11:10     ` Michael Ellerman
2016-10-19 11:10     ` Michael Ellerman
2016-10-19 11:10     ` Michael Ellerman
2016-10-19 11:10     ` Michael Ellerman
2016-10-19 11:10     ` Michael Ellerman
2016-10-13  7:32 ` [PATCH 00/10] mm: adjust get_user_pages* functions to explicitly pass FOLL_* flags Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-13  7:32   ` Christian König
2016-10-18 15:30 ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-18 15:30   ` Michal Hocko
2016-10-19  8:58   ` Lorenzo Stoakes
2016-10-19  8:58     ` Lorenzo Stoakes
2016-10-19  8:58     ` Lorenzo Stoakes
2016-10-19  8:58     ` Lorenzo Stoakes
2016-10-19  8:58     ` Lorenzo Stoakes
2016-10-19  8:58     ` Lorenzo Stoakes
2016-10-19  9:07     ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19  9:07       ` Michal Hocko
2016-10-19 16:49       ` Dave Hansen
2016-10-19 16:49         ` Dave Hansen
2016-10-19 16:49         ` Dave Hansen
2016-10-19 16:49         ` Dave Hansen
2016-10-19 16:49         ` Dave Hansen
2016-10-19 17:01         ` Michal Hocko
2016-10-19 17:01           ` Michal Hocko
2016-10-19 17:01           ` Michal Hocko
2016-10-19 17:01           ` Michal Hocko
2016-10-19 17:01           ` Michal Hocko
2016-10-19 17:23           ` Dave Hansen
2016-10-19 17:23             ` Dave Hansen
2016-10-19 17:23             ` Dave Hansen
2016-10-19 17:23             ` Dave Hansen
2016-10-19 17:23             ` Dave Hansen
2016-10-20 19:26             ` Michal Hocko
2016-10-20 19:26               ` Michal Hocko
2016-10-20 19:26               ` Michal Hocko
2016-10-20 19:26               ` Michal Hocko
2016-10-20 19:26               ` Michal Hocko
2016-10-26  8:55   ` Lorenzo Stoakes
2016-10-26  8:55     ` Lorenzo Stoakes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161013002020.3062-2-lstoakes@gmail.com \
    --to=lstoakes@gmail.com \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=akpm@linux-foundation.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hughd@google.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jack@suse.cz \
    --cc=kvm@vger.kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cris-kernel@axis.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-sh@vger.kerne \
    --cc=mgorman@techsingularity.net \
    --cc=riel@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.