The patch titled Subject: mm: replace multiple dcache flush with flush_dcache_folio() has been added to the -mm tree. Its filename is mm-replace-multiple-dcache-flush-with-flush_dcache_folio.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-replace-multiple-dcache-flush-with-flush_dcache_folio.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-replace-multiple-dcache-flush-with-flush_dcache_folio.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: Muchun Song <songmuchun@xxxxxxxxxxxxx> Subject: mm: replace multiple dcache flush with flush_dcache_folio() Simplify the code by using flush_dcache_folio(). Link: https://lkml.kernel.org/r/20220131160254.43211-6-songmuchun@xxxxxxxxxxxxx Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Lars Persson <lars.persson@xxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Mina Almasry <almasrymina@xxxxxxxxxx> Cc: Xiongchun Duan <duanxiongchun@xxxxxxxxxxxxx> Cc: Zi Yan <ziy@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 6 +----- mm/migrate.c | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) --- a/mm/hugetlb.c~mm-replace-multiple-dcache-flush-with-flush_dcache_folio +++ a/mm/hugetlb.c @@ -5804,8 +5804,6 @@ int hugetlb_mcopy_atomic_pte(struct mm_s goto out; } } else { - int i, nr; - if (vm_shared && hugetlbfs_pagecache_present(h, dst_vma, dst_addr)) { put_page(*pagep); @@ -5821,9 +5819,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_s goto out; } folio_copy(page_folio(page), page_folio(*pagep)); - nr = compound_nr(page); - for (i = 0; i < nr; i++) - flush_dcache_page(page + i); + flush_dcache_folio(page_folio(page)); put_page(*pagep); *pagep = NULL; } --- a/mm/migrate.c~mm-replace-multiple-dcache-flush-with-flush_dcache_folio +++ a/mm/migrate.c @@ -916,12 +916,8 @@ static int move_to_new_page(struct page if (!PageMappingFlags(page)) page->mapping = NULL; - if (likely(!is_zone_device_page(newpage))) { - int i, nr = compound_nr(newpage); - - for (i = 0; i < nr; i++) - flush_dcache_page(newpage + i); - } + if (likely(!is_zone_device_page(newpage))) + flush_dcache_folio(page_folio(newpage)); } out: return rc; _ Patches currently in -mm which might be from songmuchun@xxxxxxxxxxxxx are mm-thp-fix-wrong-cache-flush-in-remove_migration_pmd.patch mm-fix-missing-cache-flush-for-all-tail-pages-of-compound-page.patch mm-hugetlb-fix-missing-cache-flush-in-copy_huge_page_from_user.patch mm-hugetlb-fix-missing-cache-flush-in-hugetlb_mcopy_atomic_pte.patch mm-replace-multiple-dcache-flush-with-flush_dcache_folio.patch mm-hugetlb-free-the-2nd-vmemmap-page-associated-with-each-hugetlb-page.patch mm-hugetlb-replace-hugetlb_free_vmemmap_enabled-with-a-static_key.patch mm-sparsemem-use-page-table-lock-to-protect-kernel-pmd-operations.patch selftests-vm-add-a-hugetlb-test-case.patch mm-sparsemem-move-vmemmap-related-to-hugetlb-to-config_hugetlb_page_free_vmemmap.patch