linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm: gup: fix comment of __get_user_pages()
@ 2019-10-24 15:04 Liu Xiang
  2019-10-24 16:10 ` David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Liu Xiang @ 2019-10-24 15:04 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, jhubbard, liuxiang_1999

Fix comment of __get_user_pages() and make it more clear.

Suggested-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Liu Xiang <liuxiang_1999@126.com>
---

Changes in v2:
 as suggested by John, rewrite the comment about return value.

 mm/gup.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 8f236a3..bc6a254 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -734,11 +734,17 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
  *		Or NULL if the caller does not require them.
  * @nonblocking: whether waiting for disk IO or mmap_sem contention
  *
- * Returns number of pages pinned. This may be fewer than the number
- * requested. If nr_pages is 0 or negative, returns 0. If no pages
- * were pinned, returns -errno. Each page returned must be released
- * with a put_page() call when it is finished with. vmas will only
- * remain valid while mmap_sem is held.
+ * Returns either number of pages pinned (which may be less than the
+ * number requested), or an error. Details about the return value:
+ *
+ * -- If nr_pages is 0, returns 0.
+ * -- If nr_pages is >0, but no pages were pinned, returns -errno.
+ * -- If nr_pages is >0, and some pages were pinned, returns the number of
+ *    pages pinned. Again, this may be less than nr_pages.
+ *
+ * The caller is responsible for releasing returned @pages, via put_page().
+ *
+ * @vmas are valid only as long as mmap_sem is held.
  *
  * Must be called with mmap_sem held.  It may be released.  See below.
  *
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm: gup: fix comment of __get_user_pages()
  2019-10-24 15:04 [PATCH v2] mm: gup: fix comment of __get_user_pages() Liu Xiang
@ 2019-10-24 16:10 ` David Hildenbrand
  2019-10-24 17:40 ` John Hubbard
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2019-10-24 16:10 UTC (permalink / raw)
  To: Liu Xiang, linux-mm; +Cc: linux-kernel, jhubbard

On 24.10.19 17:04, Liu Xiang wrote:
> Fix comment of __get_user_pages() and make it more clear.
> 
> Suggested-by: John Hubbard <jhubbard@nvidia.com>
> Signed-off-by: Liu Xiang <liuxiang_1999@126.com>
> ---
> 
> Changes in v2:
>   as suggested by John, rewrite the comment about return value.
> 
>   mm/gup.c | 16 +++++++++++-----
>   1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index 8f236a3..bc6a254 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -734,11 +734,17 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
>    *		Or NULL if the caller does not require them.
>    * @nonblocking: whether waiting for disk IO or mmap_sem contention
>    *
> - * Returns number of pages pinned. This may be fewer than the number
> - * requested. If nr_pages is 0 or negative, returns 0. If no pages
> - * were pinned, returns -errno. Each page returned must be released
> - * with a put_page() call when it is finished with. vmas will only
> - * remain valid while mmap_sem is held.
> + * Returns either number of pages pinned (which may be less than the
> + * number requested), or an error. Details about the return value:
> + *
> + * -- If nr_pages is 0, returns 0.
> + * -- If nr_pages is >0, but no pages were pinned, returns -errno.
> + * -- If nr_pages is >0, and some pages were pinned, returns the number of
> + *    pages pinned. Again, this may be less than nr_pages.
> + *
> + * The caller is responsible for releasing returned @pages, via put_page().
> + *
> + * @vmas are valid only as long as mmap_sem is held.
>    *
>    * Must be called with mmap_sem held.  It may be released.  See below.
>    *
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm: gup: fix comment of __get_user_pages()
  2019-10-24 15:04 [PATCH v2] mm: gup: fix comment of __get_user_pages() Liu Xiang
  2019-10-24 16:10 ` David Hildenbrand
@ 2019-10-24 17:40 ` John Hubbard
  2019-10-24 18:41 ` David Rientjes
  2019-10-28 18:50 ` John Hubbard
  3 siblings, 0 replies; 5+ messages in thread
From: John Hubbard @ 2019-10-24 17:40 UTC (permalink / raw)
  To: Liu Xiang, linux-mm; +Cc: linux-kernel

On 10/24/19 8:04 AM, Liu Xiang wrote:
> Fix comment of __get_user_pages() and make it more clear.
> 
> Suggested-by: John Hubbard <jhubbard@nvidia.com>
> Signed-off-by: Liu Xiang <liuxiang_1999@126.com>
> ---
> 
> Changes in v2:
>  as suggested by John, rewrite the comment about return value.
> 
>  mm/gup.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 

Reviewed-by: John Hubbard <jhubbard@nvidia.com>


thanks,
-- 
John Hubbard
NVIDIA

> diff --git a/mm/gup.c b/mm/gup.c
> index 8f236a3..bc6a254 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -734,11 +734,17 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
>   *		Or NULL if the caller does not require them.
>   * @nonblocking: whether waiting for disk IO or mmap_sem contention
>   *
> - * Returns number of pages pinned. This may be fewer than the number
> - * requested. If nr_pages is 0 or negative, returns 0. If no pages
> - * were pinned, returns -errno. Each page returned must be released
> - * with a put_page() call when it is finished with. vmas will only
> - * remain valid while mmap_sem is held.
> + * Returns either number of pages pinned (which may be less than the
> + * number requested), or an error. Details about the return value:
> + *
> + * -- If nr_pages is 0, returns 0.
> + * -- If nr_pages is >0, but no pages were pinned, returns -errno.
> + * -- If nr_pages is >0, and some pages were pinned, returns the number of
> + *    pages pinned. Again, this may be less than nr_pages.
> + *
> + * The caller is responsible for releasing returned @pages, via put_page().
> + *
> + * @vmas are valid only as long as mmap_sem is held.
>   *
>   * Must be called with mmap_sem held.  It may be released.  See below.
>   *
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm: gup: fix comment of __get_user_pages()
  2019-10-24 15:04 [PATCH v2] mm: gup: fix comment of __get_user_pages() Liu Xiang
  2019-10-24 16:10 ` David Hildenbrand
  2019-10-24 17:40 ` John Hubbard
@ 2019-10-24 18:41 ` David Rientjes
  2019-10-28 18:50 ` John Hubbard
  3 siblings, 0 replies; 5+ messages in thread
From: David Rientjes @ 2019-10-24 18:41 UTC (permalink / raw)
  To: Liu Xiang; +Cc: linux-mm, linux-kernel, jhubbard

On Thu, 24 Oct 2019, Liu Xiang wrote:

> Fix comment of __get_user_pages() and make it more clear.
> 
> Suggested-by: John Hubbard <jhubbard@nvidia.com>
> Signed-off-by: Liu Xiang <liuxiang_1999@126.com>

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mm: gup: fix comment of __get_user_pages()
  2019-10-24 15:04 [PATCH v2] mm: gup: fix comment of __get_user_pages() Liu Xiang
                   ` (2 preceding siblings ...)
  2019-10-24 18:41 ` David Rientjes
@ 2019-10-28 18:50 ` John Hubbard
  3 siblings, 0 replies; 5+ messages in thread
From: John Hubbard @ 2019-10-28 18:50 UTC (permalink / raw)
  To: Liu Xiang, linux-mm; +Cc: linux-kernel

On 10/24/19 8:04 AM, Liu Xiang wrote:
> Fix comment of __get_user_pages() and make it more clear.
> 
> Suggested-by: John Hubbard <jhubbard@nvidia.com>
> Signed-off-by: Liu Xiang <liuxiang_1999@126.com>
> ---
> 
> Changes in v2:
>  as suggested by John, rewrite the comment about return value.
> 
>  mm/gup.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index 8f236a3..bc6a254 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -734,11 +734,17 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
>   *		Or NULL if the caller does not require them.
>   * @nonblocking: whether waiting for disk IO or mmap_sem contention
>   *
> - * Returns number of pages pinned. This may be fewer than the number
> - * requested. If nr_pages is 0 or negative, returns 0. If no pages
> - * were pinned, returns -errno. Each page returned must be released
> - * with a put_page() call when it is finished with. vmas will only
> - * remain valid while mmap_sem is held.
> + * Returns either number of pages pinned (which may be less than the
> + * number requested), or an error. Details about the return value:
> + *
> + * -- If nr_pages is 0, returns 0.
> + * -- If nr_pages is >0, but no pages were pinned, returns -errno.
> + * -- If nr_pages is >0, and some pages were pinned, returns the number of
> + *    pages pinned. Again, this may be less than nr_pages.
> + *
> + * The caller is responsible for releasing returned @pages, via put_page().
> + *
> + * @vmas are valid only as long as mmap_sem is held.

Just remembered: this identical paragraph is also written in the 
get_user_pages_remote() comments. It would be ideal to apply the same fix to 
that identical blob of text.


thanks,
-- 
John Hubbard
NVIDIA

>   *
>   * Must be called with mmap_sem held.  It may be released.  See below.
>   *
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-28 18:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24 15:04 [PATCH v2] mm: gup: fix comment of __get_user_pages() Liu Xiang
2019-10-24 16:10 ` David Hildenbrand
2019-10-24 17:40 ` John Hubbard
2019-10-24 18:41 ` David Rientjes
2019-10-28 18:50 ` John Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).