[patch 04/27] mm/gup.c: document return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Michael S. Tsirkin" <mst@xxxxxxxxxx>
Subject: 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@xxxxxxxxxx
Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: Huang Ying <ying.huang@xxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Thorsten Leemhuis <regressions@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 arch/mips/mm/gup.c  |    2 ++
 arch/s390/mm/gup.c  |    2 ++
 arch/sh/mm/gup.c    |    2 ++
 arch/sparc/mm/gup.c |    4 ++++
 mm/gup.c            |    4 +++-
 mm/util.c           |    6 ++++--
 6 files changed, 17 insertions(+), 3 deletions(-)

diff -puN arch/mips/mm/gup.c~mm-gup-document-return-value arch/mips/mm/gup.c
--- a/arch/mips/mm/gup.c~mm-gup-document-return-value
+++ a/arch/mips/mm/gup.c
@@ -178,6 +178,8 @@ static int gup_pud_range(pgd_t pgd, unsi
 /*
  * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
  * back to the regular GUP.
+ * Note a difference with get_user_pages_fast: this always returns the
+ * number of pages pinned, 0 if no pages were pinned.
  */
 int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			  struct page **pages)
diff -puN arch/s390/mm/gup.c~mm-gup-document-return-value arch/s390/mm/gup.c
--- a/arch/s390/mm/gup.c~mm-gup-document-return-value
+++ a/arch/s390/mm/gup.c
@@ -220,6 +220,8 @@ static inline int gup_p4d_range(pgd_t *p
 /*
  * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
  * back to the regular GUP.
+ * Note a difference with get_user_pages_fast: this always returns the
+ * number of pages pinned, 0 if no pages were pinned.
  */
 int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			  struct page **pages)
diff -puN arch/sh/mm/gup.c~mm-gup-document-return-value arch/sh/mm/gup.c
--- a/arch/sh/mm/gup.c~mm-gup-document-return-value
+++ a/arch/sh/mm/gup.c
@@ -160,6 +160,8 @@ static int gup_pud_range(pgd_t pgd, unsi
 /*
  * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
  * back to the regular GUP.
+ * Note a difference with get_user_pages_fast: this always returns the
+ * number of pages pinned, 0 if no pages were pinned.
  */
 int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			  struct page **pages)
diff -puN arch/sparc/mm/gup.c~mm-gup-document-return-value arch/sparc/mm/gup.c
--- a/arch/sparc/mm/gup.c~mm-gup-document-return-value
+++ a/arch/sparc/mm/gup.c
@@ -193,6 +193,10 @@ static int gup_pud_range(pgd_t pgd, unsi
 	return 1;
 }
 
+/*
+ * Note a difference with get_user_pages_fast: this always returns the
+ * number of pages pinned, 0 if no pages were pinned.
+ */
 int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			  struct page **pages)
 {
diff -puN mm/gup.c~mm-gup-document-return-value mm/gup.c
--- a/mm/gup.c~mm-gup-document-return-value
+++ a/mm/gup.c
@@ -1740,7 +1740,9 @@ bool gup_fast_permitted(unsigned long st
 
 /*
  * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to
- * the regular GUP. It will only return non-negative values.
+ * the regular GUP.
+ * Note a difference with get_user_pages_fast: this always returns the
+ * number of pages pinned, 0 if no pages were pinned.
  */
 int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			  struct page **pages)
diff -puN mm/util.c~mm-gup-document-return-value mm/util.c
--- a/mm/util.c~mm-gup-document-return-value
+++ a/mm/util.c
@@ -297,8 +297,10 @@ void arch_pick_mmap_layout(struct mm_str
 /*
  * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
  * back to the regular GUP.
- * If the architecture not support this function, simply return with no
- * page pinned
+ * Note a difference with get_user_pages_fast: this always returns the
+ * number of pages pinned, 0 if no pages were pinned.
+ * If the architecture does not support this function, simply return with no
+ * pages pinned.
  */
 int __weak __get_user_pages_fast(unsigned long start,
 				 int nr_pages, int write, struct page **pages)
_
--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux