From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, linux-arch@vger.kernel.org
Subject: [PATCH v2 00/11] Add folio_mk_pte()
Date: Wed, 2 Apr 2025 19:16:54 +0100 [thread overview]
Message-ID: <20250402181709.2386022-1-willy@infradead.org> (raw)
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().
Matthew Wilcox (Oracle) (11):
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()
hugetlb: Simplify make_huge_pte()
mm: Remove mk_huge_pte()
mm: Add folio_mk_pmd()
arch: Remove mk_pmd()
arch/alpha/include/asm/pgtable.h | 7 ----
arch/arc/include/asm/hugepage.h | 2 -
arch/arc/include/asm/pgtable-levels.h | 2 -
arch/arm/include/asm/pgtable-3level.h | 1 -
arch/arm/include/asm/pgtable.h | 1 -
arch/arm64/include/asm/pgtable.h | 7 ----
arch/csky/include/asm/pgtable.h | 5 ---
arch/hexagon/include/asm/pgtable.h | 3 --
arch/loongarch/include/asm/pgtable.h | 7 ----
arch/loongarch/mm/pgtable.c | 9 -----
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 | 9 -----
arch/mips/mm/pgtable-32.c | 10 -----
arch/mips/mm/pgtable-64.c | 9 -----
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/book3s/64/pgtable.h | 1 -
arch/powerpc/include/asm/pgtable.h | 3 +-
arch/powerpc/mm/book3s64/pgtable.c | 5 ---
arch/riscv/include/asm/pgtable-64.h | 2 -
arch/riscv/include/asm/pgtable.h | 2 -
arch/s390/include/asm/pgtable.h | 11 ------
arch/sh/include/asm/pgtable_32.h | 8 ----
arch/sparc/include/asm/pgtable_32.h | 15 +++-----
arch/sparc/include/asm/pgtable_64.h | 2 -
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 | 21 ++---------
arch/xtensa/include/asm/pgtable.h | 6 ---
fs/dax.c | 3 +-
include/asm-generic/hugetlb.h | 5 ---
include/linux/huge_mm.h | 2 -
include/linux/mm.h | 39 ++++++++++++++++++++
mm/debug_vm_pgtable.c | 18 +++------
mm/huge_memory.c | 11 +++---
mm/hugetlb.c | 18 ++++-----
mm/khugepaged.c | 2 +-
mm/memory.c | 10 +++--
mm/userfaultfd.c | 2 +-
44 files changed, 83 insertions(+), 243 deletions(-)
--
2.47.2
next reply other threads:[~2025-04-02 18:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 18:16 Matthew Wilcox (Oracle) [this message]
2025-04-02 18:16 ` [PATCH v2 01/11] mm: Set the pte dirty if the folio is already dirty Matthew Wilcox (Oracle)
2025-04-02 18:16 ` [PATCH v2 02/11] mm: Introduce a common definition of mk_pte() Matthew Wilcox (Oracle)
2025-04-02 18:16 ` [PATCH v2 03/11] sparc32: Remove custom " Matthew Wilcox (Oracle)
2025-04-02 18:16 ` [PATCH v2 04/11] x86: " Matthew Wilcox (Oracle)
2025-04-02 18:16 ` [PATCH v2 05/11] um: " Matthew Wilcox (Oracle)
2025-04-02 18:17 ` [PATCH v2 06/11] mm: Make mk_pte() definition unconditional Matthew Wilcox (Oracle)
2025-04-02 18:17 ` [PATCH v2 07/11] mm: Add folio_mk_pte() Matthew Wilcox (Oracle)
2025-04-02 18:17 ` [PATCH v2 08/11] hugetlb: Simplify make_huge_pte() Matthew Wilcox (Oracle)
2025-04-02 18:17 ` [PATCH v2 09/11] mm: Remove mk_huge_pte() Matthew Wilcox (Oracle)
2025-04-02 18:17 ` [PATCH v2 10/11] mm: Add folio_mk_pmd() Matthew Wilcox (Oracle)
2025-04-05 17:07 ` Zi Yan
2025-04-02 18:17 ` [PATCH v2 11/11] arch: Remove mk_pmd() Matthew Wilcox (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250402181709.2386022-1-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox