mm-set-the-pte-dirty-if-the-folio-is-already-dirty.patch removed from -mm tree
The quilt patch titled
Subject: mm: set the pte dirty if the folio is already dirty
has been removed from the -mm tree. Its filename was
mm-set-the-pte-dirty-if-the-folio-is-already-dirty.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <[email protected]>
Subject: mm: set the pte dirty if the folio is already dirty
Date: Wed, 2 Apr 2025 19:16:55 +0100
Patch series "Add folio_mk_pte()", v2.
Today if you have a folio and want to create a PTE that points to the first page in it, you have to convert from a folio to a page. That's zero-cost today but will be more expensive in the future.
I didn't want to add folio_mk_pte() to each architecture, and I didn't want to lose any optimisations that architectures have from their own implementation of mk_pte(). Fortunately, most architectures have by now turned their mk_pte() into a fairly bland variant of pfn_pte(), but s390 has a special optimisation that needs to be moved into generic code in the first patch.
At the end of this patch set, we have mk_pte() and folio_mk_pte() in mm.h and each architecture only has to implement pfn_pte(). We've also eliminated mk_huge_pte(), mk_huge_pmd() and mk_pmd().
This patch (of 11):
If the first access to a folio is a read that is then followed by a write, we can save a page fault. s390 implemented this in their mk_pte() in commit abf09bed3cce ("s390/mm: implement software dirty bits"), but other architectures can also benefit from this.
---
arch/s390/include/asm/pgtable.h | 7 +------ mm/memory.c | 2 ++ 2 files changed, 3 insertions(+), 6 deletions(-)
arch/s390/include/asm/pgtable.h renamed from arch/s390/include/asm/pgtable.h~mm-set-the-pte-dirty-if-the-folio-is-already-dirty +1 -6
@@ -1450,12 +1450,7 @@ static inline pte_t mk_pte_phys(unsignedstatic inline pte_t mk_pte (struct page *page,pgprot_t pgprot) { -unsigned long physpage =page_to_phys (page); -pte_t __pte =mk_pte_phys (physpage, pgprot); - -if (pte_write (__pte) &&PageDirty (page)) - __pte =pte_mkdirty (__pte); -return __pte; +return mk_pte_phys (page_to_phys (page), pgprot); }#define pgd_index (address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
mm/memory.c renamed from mm/memory.c~mm-set-the-pte-dirty-if-the-folio-is-already-dirty +2 -0
@@ -5245,6 +5245,8 @@ void set_pte_range(struct vm_fault *vmf,if (write) entry =maybe_mkwrite (pte_mkdirty (entry), vma); +else if (pte_write (entry) &&folio_test_dirty (folio)) + entry =pte_mkdirty (entry);if (unlikely (vmf_orig_pte_uffd_wp (vmf))) entry =pte_mkuffd_wp (entry);/* copy-on-write page */
_
Patches currently in -mm which might be from [email protected] are