linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs
@ 2020-05-29  8:45 John Hubbard
  2020-05-29  9:11 ` David Hildenbrand
  2020-05-31 13:00 ` Pankaj Gupta
  0 siblings, 2 replies; 4+ messages in thread
From: John Hubbard @ 2020-05-29  8:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Souptick Joarder, LKML, linux-mm, John Hubbard, Dan Carpenter,
	Jan Kara, Vlastimil Babka

All of the pin_user_pages*() API calls will cause pages to be
dma-pinned. As such, they are all suitable for either DMA, RDMA,
and/or Direct IO. The documentation should say so, but it was
instead saying that three of the API calls were only suitable for
Direct IO. This was discovered when a reviewer wondered why an
API call that specifically recommended against Case 2 (DMA/RDMA)
was being used in a DMA situation [1].

Fix this by simply deleting those claims. The gup.c comments already
refer to the more extensive Documentation/core-api/pin_user_pages.rst,
which does have the correct guidance. So let's just write it once,
there.

[1] https://lore.kernel.org/r/20200529074658.GM30374@kadam

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---

Hi,

This applies on top of linux-next, in order to avoid a conflict with
Mauro Carvalho Chehab's fix to the lines right above these.

thanks,
John Hubbard
NVIDIA


 mm/gup.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index ee039d421746d..311d0f11b35e6 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2875,9 +2875,6 @@ EXPORT_SYMBOL_GPL(get_user_pages_fast);
  *
  * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
  * see Documentation/core-api/pin_user_pages.rst for further details.
- *
- * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
- * is NOT intended for Case 2 (RDMA: long-term pins).
  */
 int pin_user_pages_fast(unsigned long start, int nr_pages,
 			unsigned int gup_flags, struct page **pages)
@@ -2951,9 +2948,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast_only);
  *
  * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
  * see Documentation/core-api/pin_user_pages.rst for details.
- *
- * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
- * is NOT intended for Case 2 (RDMA: long-term pins).
  */
 long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
 			   unsigned long start, unsigned long nr_pages,
@@ -2987,9 +2981,6 @@ EXPORT_SYMBOL(pin_user_pages_remote);
  *
  * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
  * see Documentation/core-api/pin_user_pages.rst for details.
- *
- * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
- * is NOT intended for Case 2 (RDMA: long-term pins).
  */
 long pin_user_pages(unsigned long start, unsigned long nr_pages,
 		    unsigned int gup_flags, struct page **pages,
-- 
2.26.2



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

* Re: [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs
  2020-05-29  8:45 [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs John Hubbard
@ 2020-05-29  9:11 ` David Hildenbrand
  2020-05-31  6:51   ` Souptick Joarder
  2020-05-31 13:00 ` Pankaj Gupta
  1 sibling, 1 reply; 4+ messages in thread
From: David Hildenbrand @ 2020-05-29  9:11 UTC (permalink / raw)
  To: John Hubbard, Andrew Morton
  Cc: Souptick Joarder, LKML, linux-mm, Dan Carpenter, Jan Kara,
	Vlastimil Babka

On 29.05.20 10:45, John Hubbard wrote:
> All of the pin_user_pages*() API calls will cause pages to be
> dma-pinned. As such, they are all suitable for either DMA, RDMA,
> and/or Direct IO. The documentation should say so, but it was
> instead saying that three of the API calls were only suitable for
> Direct IO. This was discovered when a reviewer wondered why an
> API call that specifically recommended against Case 2 (DMA/RDMA)
> was being used in a DMA situation [1].
> 
> Fix this by simply deleting those claims. The gup.c comments already
> refer to the more extensive Documentation/core-api/pin_user_pages.rst,
> which does have the correct guidance. So let's just write it once,
> there.
> 
> [1] https://lore.kernel.org/r/20200529074658.GM30374@kadam
> 
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
> 
> Hi,
> 
> This applies on top of linux-next, in order to avoid a conflict with
> Mauro Carvalho Chehab's fix to the lines right above these.
> 
> thanks,
> John Hubbard
> NVIDIA
> 
> 
>  mm/gup.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/mm/gup.c b/mm/gup.c
> index ee039d421746d..311d0f11b35e6 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -2875,9 +2875,6 @@ EXPORT_SYMBOL_GPL(get_user_pages_fast);
>   *
>   * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
>   * see Documentation/core-api/pin_user_pages.rst for further details.
> - *
> - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
> - * is NOT intended for Case 2 (RDMA: long-term pins).
>   */
>  int pin_user_pages_fast(unsigned long start, int nr_pages,
>  			unsigned int gup_flags, struct page **pages)
> @@ -2951,9 +2948,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast_only);
>   *
>   * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
>   * see Documentation/core-api/pin_user_pages.rst for details.
> - *
> - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
> - * is NOT intended for Case 2 (RDMA: long-term pins).
>   */
>  long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
>  			   unsigned long start, unsigned long nr_pages,
> @@ -2987,9 +2981,6 @@ EXPORT_SYMBOL(pin_user_pages_remote);
>   *
>   * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
>   * see Documentation/core-api/pin_user_pages.rst for details.
> - *
> - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
> - * is NOT intended for Case 2 (RDMA: long-term pins).
>   */
>  long pin_user_pages(unsigned long start, unsigned long nr_pages,
>  		    unsigned int gup_flags, struct page **pages,
> 

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

-- 
Thanks,

David / dhildenb



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

* Re: [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs
  2020-05-29  9:11 ` David Hildenbrand
@ 2020-05-31  6:51   ` Souptick Joarder
  0 siblings, 0 replies; 4+ messages in thread
From: Souptick Joarder @ 2020-05-31  6:51 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: John Hubbard, Andrew Morton, LKML, Linux-MM, Dan Carpenter,
	Jan Kara, Vlastimil Babka

On Fri, May 29, 2020 at 2:41 PM David Hildenbrand <david@redhat.com> wrote:
>
> On 29.05.20 10:45, John Hubbard wrote:
> > All of the pin_user_pages*() API calls will cause pages to be
> > dma-pinned. As such, they are all suitable for either DMA, RDMA,
> > and/or Direct IO. The documentation should say so, but it was
> > instead saying that three of the API calls were only suitable for
> > Direct IO. This was discovered when a reviewer wondered why an
> > API call that specifically recommended against Case 2 (DMA/RDMA)
> > was being used in a DMA situation [1].
> >
> > Fix this by simply deleting those claims. The gup.c comments already
> > refer to the more extensive Documentation/core-api/pin_user_pages.rst,
> > which does have the correct guidance. So let's just write it once,
> > there.
> >
> > [1] https://lore.kernel.org/r/20200529074658.GM30374@kadam
> >
> > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Jan Kara <jack@suse.cz>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> > ---
> >
> > Hi,
> >
> > This applies on top of linux-next, in order to avoid a conflict with
> > Mauro Carvalho Chehab's fix to the lines right above these.
> >
> > thanks,
> > John Hubbard
> > NVIDIA
> >
> >
> >  mm/gup.c | 9 ---------
> >  1 file changed, 9 deletions(-)
> >
> > diff --git a/mm/gup.c b/mm/gup.c
> > index ee039d421746d..311d0f11b35e6 100644
> > --- a/mm/gup.c
> > +++ b/mm/gup.c
> > @@ -2875,9 +2875,6 @@ EXPORT_SYMBOL_GPL(get_user_pages_fast);
> >   *
> >   * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
> >   * see Documentation/core-api/pin_user_pages.rst for further details.
> > - *
> > - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
> > - * is NOT intended for Case 2 (RDMA: long-term pins).
> >   */
> >  int pin_user_pages_fast(unsigned long start, int nr_pages,
> >                       unsigned int gup_flags, struct page **pages)
> > @@ -2951,9 +2948,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast_only);
> >   *
> >   * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
> >   * see Documentation/core-api/pin_user_pages.rst for details.
> > - *
> > - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
> > - * is NOT intended for Case 2 (RDMA: long-term pins).
> >   */
> >  long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
> >                          unsigned long start, unsigned long nr_pages,
> > @@ -2987,9 +2981,6 @@ EXPORT_SYMBOL(pin_user_pages_remote);
> >   *
> >   * FOLL_PIN means that the pages must be released via unpin_user_page(). Please
> >   * see Documentation/core-api/pin_user_pages.rst for details.
> > - *
> > - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It
> > - * is NOT intended for Case 2 (RDMA: long-term pins).
> >   */
> >  long pin_user_pages(unsigned long start, unsigned long nr_pages,
> >                   unsigned int gup_flags, struct page **pages,
> >
>
> Reviewed-by: David Hildenbrand <david@redhat.com>

Acked-by : Souptick Joarder <jrdr.linux@gmail.com>

>
> --
> Thanks,
>
> David / dhildenb
>


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

* Re: [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs
  2020-05-29  8:45 [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs John Hubbard
  2020-05-29  9:11 ` David Hildenbrand
@ 2020-05-31 13:00 ` Pankaj Gupta
  1 sibling, 0 replies; 4+ messages in thread
From: Pankaj Gupta @ 2020-05-31 13:00 UTC (permalink / raw)
  To: John Hubbard
  Cc: Andrew Morton, Souptick Joarder, LKML, Linux MM, Dan Carpenter,
	Jan Kara, Vlastimil Babka

Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>


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

end of thread, other threads:[~2020-05-31 13:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  8:45 [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs John Hubbard
2020-05-29  9:11 ` David Hildenbrand
2020-05-31  6:51   ` Souptick Joarder
2020-05-31 13:00 ` Pankaj Gupta

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).