The patch titled Subject: mm: remove page_maybe_dma_pinned() has been added to the -mm mm-unstable branch. Its filename is mm-remove-page_maybe_dma_pinned.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-remove-page_maybe_dma_pinned.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Subject: mm: remove page_maybe_dma_pinned() Date: Tue, 4 Jun 2024 19:48:20 +0800 After the last user of page_maybe_dma_pinned() is converted to folio_maybe_dma_pinned(), remove page_maybe_dma_pinned() and update the document and comment. Link: https://lkml.kernel.org/r/20240604114822.2089819-3-wangkefeng.wang@xxxxxxxxxx Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: Daniel Vetter <daniel@xxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Helge Deller <deller@xxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/core-api/pin_user_pages.rst | 10 +++++----- include/linux/mm.h | 9 ++------- 2 files changed, 7 insertions(+), 12 deletions(-) --- a/Documentation/core-api/pin_user_pages.rst~mm-remove-page_maybe_dma_pinned +++ a/Documentation/core-api/pin_user_pages.rst @@ -196,20 +196,20 @@ INCORRECT (uses FOLL_GET calls): write to the data within the pages put_page() -page_maybe_dma_pinned(): the whole point of pinning +folio_maybe_dma_pinned(): the whole point of pinning =================================================== -The whole point of marking pages as "DMA-pinned" or "gup-pinned" is to be able -to query, "is this page DMA-pinned?" That allows code such as page_mkclean() +The whole point of marking folios as "DMA-pinned" or "gup-pinned" is to be able +to query, "is this folio DMA-pinned?" That allows code such as page_mkclean() (and file system writeback code in general) to make informed decisions about -what to do when a page cannot be unmapped due to such pins. +what to do when a folio cannot be unmapped due to such pins. What to do in those cases is the subject of a years-long series of discussions and debates (see the References at the end of this document). It's a TODO item here: fill in the details once that's worked out. Meanwhile, it's safe to say that having this available: :: - static inline bool page_maybe_dma_pinned(struct page *page) + static inline bool folio_maybe_dma_pinned(struct folio *folio) ...is a prerequisite to solving the long-running gup+DMA problem. --- a/include/linux/mm.h~mm-remove-page_maybe_dma_pinned +++ a/include/linux/mm.h @@ -1940,8 +1940,8 @@ static inline struct folio *pfn_folio(un * * For more information, please see Documentation/core-api/pin_user_pages.rst. * - * Return: True, if it is likely that the page has been "dma-pinned". - * False, if the page is definitely not dma-pinned. + * Return: True, if it is likely that the folio has been "dma-pinned". + * False, if the folio is definitely not dma-pinned. */ static inline bool folio_maybe_dma_pinned(struct folio *folio) { @@ -1960,11 +1960,6 @@ static inline bool folio_maybe_dma_pinne GUP_PIN_COUNTING_BIAS; } -static inline bool page_maybe_dma_pinned(struct page *page) -{ - return folio_maybe_dma_pinned(page_folio(page)); -} - /* * This should most likely only be called during fork() to see whether we * should break the cow immediately for an anon page on the src mm. _ Patches currently in -mm which might be from wangkefeng.wang@xxxxxxxxxx are mm-add-folio_alloc_mpol.patch mm-mempolicy-use-folio_alloc_mpol_noprof-in-vma_alloc_folio_noprof.patch mm-mempolicy-use-folio_alloc_mpol-in-alloc_migration_target_by_mpol.patch mm-shmem-use-folio_alloc_mpol-in-shmem_alloc_folio.patch mm-refactor-folio_undo_large_rmappable.patch mm-memcontrol-remove-page_memcg.patch rmap-remove-define_page_vma_walk.patch mm-migrate-simplify-__buffer_migrate_folio.patch mm-migrate_device-use-a-newfolio-in-__migrate_device_pages.patch mm-migrate_device-unify-migrate-folio-for-migrate_sync_no_copy.patch mm-migrate-remove-migrate_folio_extra.patch mm-remove-migrate_sync_no_copy-mode.patch fs-proc-task_mmu-use-folio-api-in-pte_is_pinned.patch mm-remove-page_maybe_dma_pinned.patch fb_defio-use-a-folio-in-fb_deferred_io_work.patch mm-remove-page_mkclean.patch