Skip to contentSkip to conversation

mm/gup: documentation fix for pin_user_pages*() APIs

PATCH Applied John Hubbard 4 participants 4 messages May 29, 2020 – May 31, 2020

Subsystems (2)
lore
Share & tools
lore

John Hubbard

author reviewer
#0 lore raw

PATCH 1/1 mm/gup: documentation fix for pin_user_pages*() APIs

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 <[email protected]>
Cc Jan Kara <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

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(-)
mm/gup.c +0 -9
index ee039d421746d..311d0f11b35e6 100644
@@ -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,
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 60 lines · John Hubbard

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 <[email protected]>
Cc Jan Kara <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

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(-)
mm/gup.c +0 -6
index ee039d421746d..311d0f11b35e6 100644
@@ -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,

mm/gup.c EXPORT_SYMBOL(pin_user_pages_remote); · line 2986

Quoted 9 lines
mm/gup.c +0 -3
@@ -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,
Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 65 lines · David Hildenbrand
Quoted 63 lines · John Hubbard

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 <[email protected]>
Cc Jan Kara <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

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(-)
mm/gup.c +0 -7
index ee039d421746d..311d0f11b35e6 100644
@@ -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.
- *
Quoted 8 lines

mm/gup.c EXPORT_SYMBOL(pin_user_pages_remote); · line 2986

Quoted 6 lines
mm/gup.c +0 -2
- * 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,
Quoted 6 lines

--
Thanks,

David / dhildenb