summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2018-04-13 18:35:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-13 20:10:27 -0400
commitd081107867b85cc7454b9d4f5aea47f65bcf06d1 (patch)
tree4cd38640b68f5b53262a2a1e354e3c6efc131103
parentc61611f70958d86f659bca25c02ae69413747a8d (diff)
mm/gup.c: document return value
__get_user_pages_fast handles errors differently from get_user_pages_fast: the former always returns the number of pages pinned, the later might return a negative error code. Link: http://lkml.kernel.org/r/1522962072-182137-6-git-send-email-mst@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Huang Ying <ying.huang@intel.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Thorsten Leemhuis <regressions@leemhuis.info> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/mips/mm/gup.c2
-rw-r--r--arch/s390/mm/gup.c2
-rw-r--r--arch/sh/mm/gup.c2
-rw-r--r--arch/sparc/mm/gup.c4
-rw-r--r--mm/gup.c4
-rw-r--r--mm/util.c6
6 files changed, 17 insertions, 3 deletions
diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
index 1e4658eee13f..5a4875cac1ec 100644
--- a/arch/mips/mm/gup.c
+++ b/arch/mips/mm/gup.c
@@ -178,6 +178,8 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
178/* 178/*
179 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall 179 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
180 * back to the regular GUP. 180 * back to the regular GUP.
181 * Note a difference with get_user_pages_fast: this always returns the
182 * number of pages pinned, 0 if no pages were pinned.
181 */ 183 */
182int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 184int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
183 struct page **pages) 185 struct page **pages)
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index 05c8abd864f1..2809d11c7a28 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -220,6 +220,8 @@ static inline int gup_p4d_range(pgd_t *pgdp, pgd_t pgd, unsigned long addr,
220/* 220/*
221 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall 221 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
222 * back to the regular GUP. 222 * back to the regular GUP.
223 * Note a difference with get_user_pages_fast: this always returns the
224 * number of pages pinned, 0 if no pages were pinned.
223 */ 225 */
224int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 226int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
225 struct page **pages) 227 struct page **pages)
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c
index 8045b5bb7075..56c86ca98ecf 100644
--- a/arch/sh/mm/gup.c
+++ b/arch/sh/mm/gup.c
@@ -160,6 +160,8 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
160/* 160/*
161 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall 161 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
162 * back to the regular GUP. 162 * back to the regular GUP.
163 * Note a difference with get_user_pages_fast: this always returns the
164 * number of pages pinned, 0 if no pages were pinned.
163 */ 165 */
164int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 166int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
165 struct page **pages) 167 struct page **pages)
diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c
index 357b6047653a..aee6dba83d0e 100644
--- a/arch/sparc/mm/gup.c
+++ b/arch/sparc/mm/gup.c
@@ -193,6 +193,10 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
193 return 1; 193 return 1;
194} 194}
195 195
196/*
197 * Note a difference with get_user_pages_fast: this always returns the
198 * number of pages pinned, 0 if no pages were pinned.
199 */
196int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 200int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
197 struct page **pages) 201 struct page **pages)
198{ 202{
diff --git a/mm/gup.c b/mm/gup.c
index db5346f80a5a..76af4cfeaf68 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1740,7 +1740,9 @@ bool gup_fast_permitted(unsigned long start, int nr_pages, int write)
1740 1740
1741/* 1741/*
1742 * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to 1742 * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to
1743 * the regular GUP. It will only return non-negative values. 1743 * the regular GUP.
1744 * Note a difference with get_user_pages_fast: this always returns the
1745 * number of pages pinned, 0 if no pages were pinned.
1744 */ 1746 */
1745int __get_user_pages_fast(unsigned long start, int nr_pages, int write, 1747int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
1746 struct page **pages) 1748 struct page **pages)
diff --git a/mm/util.c b/mm/util.c
index 1fc4fa7576f7..45fc3169e7b0 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -297,8 +297,10 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack)
297/* 297/*
298 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall 298 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
299 * back to the regular GUP. 299 * back to the regular GUP.
300 * If the architecture not support this function, simply return with no 300 * Note a difference with get_user_pages_fast: this always returns the
301 * page pinned 301 * number of pages pinned, 0 if no pages were pinned.
302 * If the architecture does not support this function, simply return with no
303 * pages pinned.
302 */ 304 */
303int __weak __get_user_pages_fast(unsigned long start, 305int __weak __get_user_pages_fast(unsigned long start,
304 int nr_pages, int write, struct page **pages) 306 int nr_pages, int write, struct page **pages)