The patch titled Subject: mm/gup: use unpin_user_pages() in check_and_migrate_cma_pages() has been added to the -mm tree. Its filename is mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages.patch
This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-gup-use-unpin_user_pages-in-che... and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-use-unpin_user_pages-in-che...
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: Jason Gunthorpe jgg@nvidia.com Subject: mm/gup: use unpin_user_pages() in check_and_migrate_cma_pages()
When FOLL_PIN is passed to __get_user_pages() the page list must be put back using unpin_user_pages() otherwise the page pin reference persists in a corrupted state.
Link: https://lkml.kernel.org/r/0-v1-976effcd4468+d4-gup_cma_fix_jgg@nvidia.com Fixes: 3faa52c03f44 ("mm/gup: track FOLL_PIN pages") Signed-off-by: Jason Gunthorpe jgg@nvidia.com Cc: Aneesh Kumar K.V aneesh.kumar@linux.ibm.com Cc: Claudio Imbrenda imbrenda@linux.ibm.com Cc: Ira Weiny ira.weiny@intel.com Cc: Jan Kara jack@suse.cz Cc: John Hubbard jhubbard@nvidia.com Cc: stable@vger.kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org ---
mm/gup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
--- a/mm/gup.c~mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages +++ a/mm/gup.c @@ -1647,8 +1647,11 @@ check_again: /* * drop the above get_user_pages reference. */ - for (i = 0; i < nr_pages; i++) - put_page(pages[i]); + if (gup_flags & FOLL_PIN) + unpin_user_pages(pages, nr_pages); + else + for (i = 0; i < nr_pages; i++) + put_page(pages[i]);
if (migrate_pages(&cma_page_list, alloc_migration_target, NULL, (unsigned long)&mtc, MIGRATE_SYNC, MR_CONTIG_RANGE)) { _
Patches currently in -mm which might be from jgg@nvidia.com are
mm-always-have-io_remap_pfn_range-set-pgprot_decrypted.patch mm-gup-use-unpin_user_pages-in-check_and_migrate_cma_pages.patch