The patch titled Subject: docs: mm/gup: pin_user_pages.rst: add a "case 5" has been added to the -mm tree. Its filename is docs-mm-gup-pin_user_pagesrst-add-a-case-5-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/docs-mm-gup-pin_user_pagesrst-add-a-case-5-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/docs-mm-gup-pin_user_pagesrst-add-a-case-5-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: John Hubbard <jhubbard@xxxxxxxxxx> Subject: docs: mm/gup: pin_user_pages.rst: add a "case 5" There are four cases listed in pin_user_pages.rst. These are intended to help developers figure out whether to use get_user_pages*(), or pin_user_pages*(). However, the four cases do not cover all the situations. For example, drivers/vhost/vhost.c has a "pin, write to page, set page dirty, unpin" case. Add a fifth case, to help explain that there is a general pattern that requires pin_user_pages*() API calls. Link: http://lkml.kernel.org/r/20200601052633.853874-2-jhubbard@xxxxxxxxxx Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Cc: Jérôme Glisse <jglisse@xxxxxxxxxx> Cc: Dave Chinner <david@xxxxxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Souptick Joarder <jrdr.linux@xxxxxxxxx> Cc: "Michael S . Tsirkin" <mst@xxxxxxxxxx> Cc: Jason Wang <jasowang@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/core-api/pin_user_pages.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/Documentation/core-api/pin_user_pages.rst~docs-mm-gup-pin_user_pagesrst-add-a-case-5-v2 +++ a/Documentation/core-api/pin_user_pages.rst @@ -174,21 +174,19 @@ needs to be set. CASE 5: Pinning in order to write to the data within the page ------------------------------------------------------------- Even though neither DMA nor Direct IO is involved, just a simple case of "pin, -access page's data, unpin" can cause a problem. Case 5 may be considered a +write to a page's data, unpin" can cause a problem. Case 5 may be considered a superset of Case 1, plus Case 2, plus anything that invokes that pattern. In other words, if the code is neither Case 1 nor Case 2, it may still require FOLL_PIN, for patterns like this: Correct (uses FOLL_PIN calls): pin_user_pages() - access the data within the pages - set_page_dirty_lock() + write to the data within the pages unpin_user_pages() INCORRECT (uses FOLL_GET calls): get_user_pages() - access the data within the pages - set_page_dirty_lock() + write to the data within the pages put_page() page_maybe_dma_pinned(): the whole point of pinning _ Patches currently in -mm which might be from jhubbard@xxxxxxxxxx are mm-gup-update-pin_user_pagesrst-for-case-3-mmu-notifiers.patch mm-gup-introduce-pin_user_pages_locked.patch mm-gup-introduce-pin_user_pages_locked-v2.patch mm-gup-frame_vector-convert-get_user_pages-pin_user_pages.patch mm-gup-documentation-fix-for-pin_user_pages-apis.patch docs-mm-gup-pin_user_pagesrst-add-a-case-5.patch docs-mm-gup-pin_user_pagesrst-add-a-case-5-v2.patch vhost-convert-get_user_pages-pin_user_pages.patch