Skip to content

Commit d081107

Browse files
mstsirkintorvalds
authored andcommitted
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/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Huang Ying <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Thorsten Leemhuis <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c61611f commit d081107

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

arch/mips/mm/gup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
178178
/*
179179
* Like get_user_pages_fast() except its IRQ-safe in that it won't fall
180180
* 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.
181183
*/
182184
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
183185
struct page **pages)

arch/s390/mm/gup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ static inline int gup_p4d_range(pgd_t *pgdp, pgd_t pgd, unsigned long addr,
220220
/*
221221
* Like get_user_pages_fast() except its IRQ-safe in that it won't fall
222222
* 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.
223225
*/
224226
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
225227
struct page **pages)

arch/sh/mm/gup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
160160
/*
161161
* Like get_user_pages_fast() except its IRQ-safe in that it won't fall
162162
* 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.
163165
*/
164166
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
165167
struct page **pages)

arch/sparc/mm/gup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
193193
return 1;
194194
}
195195

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+
*/
196200
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
197201
struct page **pages)
198202
{

mm/gup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,9 @@ bool gup_fast_permitted(unsigned long start, int nr_pages, int write)
17401740

17411741
/*
17421742
* 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.
17441746
*/
17451747
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
17461748
struct page **pages)

mm/util.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ void arch_pick_mmap_layout(struct mm_struct *mm, struct rlimit *rlim_stack)
297297
/*
298298
* Like get_user_pages_fast() except its IRQ-safe in that it won't fall
299299
* back to the regular GUP.
300-
* If the architecture not support this function, simply return with no
301-
* page pinned
300+
* Note a difference with get_user_pages_fast: this always returns the
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.
302304
*/
303305
int __weak __get_user_pages_fast(unsigned long start,
304306
int nr_pages, int write, struct page **pages)

0 commit comments

Comments
 (0)