sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Add folio_mk_pte() and simplify mk_pte()
@ 2025-02-17 19:08 Matthew Wilcox (Oracle)
  2025-02-17 19:08 ` [PATCH 1/7] mm: Set the pte dirty if the folio is already dirty Matthew Wilcox (Oracle)
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Matthew Wilcox (Oracle) @ 2025-02-17 19:08 UTC (permalink / raw)
  To: linux-mm
  Cc: Matthew Wilcox (Oracle), linux-arch, x86, linux-s390, sparclinux,
	linux-um

The intent is to add folio_mk_pte() to remove the conversion from folio
to page necessary to call mk_pte().  Eventually we might end up removing
mk_pte(), but that's not what's being proposed today.

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 is different.

So patch 1 hoists the optimisation of calling pte_mkdirty() from s390
to generic code.  I'd appreciate some eyes on this from mm people who
understand this better than I do.  I originally had

-	if (write)
+	if (write || folio_test_dirty(folio))
		entry = maybe_mkwrite(pte_mkdirty(entry), vma);

and I think that broke COW under some circumstances that 01.org could
reproduce and I couldn't.

The various architecture maintainers might care to make sure that what
I've done is an equivalent transformation.  x86 was particularly tricky.
The build bots say it works ... at least now I've dealt with the pesky
!MMU problem.

The last patch to actually use folio_mk_pte() ought to be the least likely
to have a problem  since it's equivalent to calling mk_pte(&folio->page).

Matthew Wilcox (Oracle) (7):
  mm: Set the pte dirty if the folio is already dirty
  mm: Introduce a common definition of mk_pte()
  sparc32: Remove custom definition of mk_pte()
  x86: Remove custom definition of mk_pte()
  um: Remove custom definition of mk_pte()
  mm: Make mk_pte() definition unconditional
  mm: Add folio_mk_pte()

 arch/alpha/include/asm/pgtable.h         |  7 -------
 arch/arc/include/asm/pgtable-levels.h    |  1 -
 arch/arm/include/asm/pgtable.h           |  1 -
 arch/arm64/include/asm/pgtable.h         |  6 ------
 arch/csky/include/asm/pgtable.h          |  5 -----
 arch/hexagon/include/asm/pgtable.h       |  3 ---
 arch/loongarch/include/asm/pgtable.h     |  6 ------
 arch/m68k/include/asm/mcf_pgtable.h      |  6 ------
 arch/m68k/include/asm/motorola_pgtable.h |  6 ------
 arch/m68k/include/asm/sun3_pgtable.h     |  6 ------
 arch/microblaze/include/asm/pgtable.h    |  8 --------
 arch/mips/include/asm/pgtable.h          |  6 ------
 arch/nios2/include/asm/pgtable.h         |  6 ------
 arch/openrisc/include/asm/pgtable.h      |  2 --
 arch/parisc/include/asm/pgtable.h        |  6 ------
 arch/powerpc/include/asm/pgtable.h       |  3 +--
 arch/riscv/include/asm/pgtable.h         |  2 --
 arch/s390/include/asm/pgtable.h          | 10 ----------
 arch/sh/include/asm/pgtable_32.h         |  8 --------
 arch/sparc/include/asm/pgtable_32.h      | 15 +++++----------
 arch/sparc/include/asm/pgtable_64.h      |  1 -
 arch/um/include/asm/pgtable-2level.h     |  1 -
 arch/um/include/asm/pgtable-4level.h     |  9 ---------
 arch/um/include/asm/pgtable.h            | 18 ++++++++----------
 arch/x86/include/asm/pgtable.h           | 19 +++----------------
 arch/xtensa/include/asm/pgtable.h        |  6 ------
 include/linux/mm.h                       | 22 ++++++++++++++++++++++
 mm/memory.c                              |  8 +++++---
 mm/userfaultfd.c                         |  2 +-
 29 files changed, 45 insertions(+), 154 deletions(-)

-- 
2.47.2


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-02-19 21:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 19:08 [PATCH 0/7] Add folio_mk_pte() and simplify mk_pte() Matthew Wilcox (Oracle)
2025-02-17 19:08 ` [PATCH 1/7] mm: Set the pte dirty if the folio is already dirty Matthew Wilcox (Oracle)
2025-02-18 10:31   ` David Hildenbrand
2025-02-18 16:20   ` Alexander Gordeev
2025-02-18 17:06     ` Matthew Wilcox
2025-02-19  7:27       ` Alexander Gordeev
2025-02-19  7:33   ` Alexander Gordeev
2025-02-19  8:46     ` Alexander Gordeev
2025-02-17 19:08 ` [PATCH 2/7] mm: Introduce a common definition of mk_pte() Matthew Wilcox (Oracle)
2025-02-18  8:15   ` Geert Uytterhoeven
2025-02-18 10:32   ` David Hildenbrand
2025-02-19  9:07   ` Alexander Gordeev
2025-02-17 19:08 ` [PATCH 3/7] sparc32: Remove custom " Matthew Wilcox (Oracle)
2025-02-17 19:08 ` [PATCH 4/7] x86: " Matthew Wilcox (Oracle)
2025-02-19 20:53   ` Dave Hansen
2025-02-17 19:08 ` [PATCH 5/7] um: " Matthew Wilcox (Oracle)
2025-02-17 19:08 ` [PATCH 6/7] mm: Make mk_pte() definition unconditional Matthew Wilcox (Oracle)
2025-02-18 10:32   ` David Hildenbrand
2025-02-17 19:08 ` [PATCH 7/7] mm: Add folio_mk_pte() Matthew Wilcox (Oracle)
2025-02-18 10:33   ` David Hildenbrand
2025-02-18 10:29 ` [PATCH 0/7] Add folio_mk_pte() and simplify mk_pte() David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).