From: Yunhui Cui <cuiyunhui@bytedance.com>
To: linux-riscv@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, kvm-riscv@lists.infradead.org,
kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-efi@vger.kernel.org, linux-perf-users@vger.kernel.org,
kasan-dev@googlegroups.com, Yunhui Cui <cuiyunhui@bytedance.com>
Subject: [PATCH v2 00/15] riscv: add Svnapot PTE folding support
Date: Thu, 16 Jul 2026 20:41:35 +0800 [thread overview]
Message-ID: <cover.1784201104.git.cuiyunhui@bytedance.com> (raw)
Svnapot can encode a naturally aligned 64KB range as a single folded
PTE block. This series adds the RISC-V MM support needed to use that
encoding for suitable user mappings while preserving the generic MM view
of PAGE_SIZE PTEs.
The series starts by adding raw PTE helpers and switching architecture
page-table users that must see the encoded page-table entry to those raw
helpers. It then introduces Svnapot read-side and update helpers for
folded PTE ranges. Later patches make the generic PTE batch and leaf-size
interfaces work with the raw encoded view where required, avoid redundant
A/D aggregation and TLB flushes, optimize mprotect() for Svnapot ranges,
and request 64KB executable folios when Svnapot is available so text
mappings can benefit from lower iTLB pressure.
Dependency:
- This series depends on the prerequisite RISC-V patch posted at:
https://lore.kernel.org/all/20260618064406.14508-1-cuiyunhui@bytedance.com/
Changes in v2:
- Rework the v1 7-patch series into 15 smaller patches: split raw PTE
helper introduction from the architecture-user conversion, and split
Svnapot contpte handling into read-side and update-side pieces.
- Add the generic MM helper changes needed by folded Svnapot mappings,
including folio-batch comparison flags, raw-entry leaf-size queries and
fast-GUP-specific lockless PTE helpers.
- Make the RISC-V pte_batch_hint() implementation honor folio batch
flags, and preserve Svnapot leaf-size semantics via __ptep_leaf_size().
- Add follow-up fixes and optimizations that were not in v1: avoid
redundant A/D aggregation, avoid Svnapot consistency checks in
ptep_get(), avoid A/D aggregation in fast-GUP, remove a redundant TLB
flush, optimize mprotect() for Svnapot mappings, and request large
executable folios when Svnapot is available.
Yunhui Cui (15):
riscv: introduce raw PTE helpers
riscv: switch arch page-table users to raw PTE helpers
riscv/mm: implement Svnapot contpte read-side helpers
riscv/mm: implement Svnapot contpte update helpers
mm: extend pte batch and leaf-size helpers
riscv: make pte_batch_hint() honor folio batch flags
riscv/mm: preserve Svnapot leaf-size semantics for page-table
consumers
riscv/mm: avoid redundant Svnapot A/D aggregation
riscv/mm: avoid Svnapot consistency checks in ptep_get()
mm/gup: add fast-GUP specific lockless PTE helpers
riscv: mm: avoid Svnapot A/D aggregation in fast-GUP
arm64: mm: avoid contpte A/D aggregation in fast-GUP
riscv/mm: remove redundant TLB flush in napotpte_convert
riscv/mm: optimize mprotect for Svnapot mappings
riscv: mm: Request large exec folios for Svnapot
arch/arm64/include/asm/pgtable.h | 25 +-
arch/riscv/include/asm/kfence.h | 4 +-
arch/riscv/include/asm/pgtable.h | 480 +++++++++++++++++-
arch/riscv/kernel/efi.c | 4 +-
arch/riscv/kernel/hibernate.c | 3 +-
arch/riscv/kvm/gstage.c | 25 +-
arch/riscv/kvm/mmu.c | 4 +-
arch/riscv/mm/Makefile | 1 +
arch/riscv/mm/contpte.c | 804 +++++++++++++++++++++++++++++++
arch/riscv/mm/fault.c | 4 +-
arch/riscv/mm/hugetlbpage.c | 135 ++++--
arch/riscv/mm/init.c | 8 +-
arch/riscv/mm/kasan_init.c | 16 +-
arch/riscv/mm/pageattr.c | 12 +-
arch/riscv/mm/pgtable.c | 52 +-
include/linux/pgtable.h | 71 ++-
kernel/events/core.c | 2 +-
mm/gup.c | 6 +-
mm/internal.h | 39 +-
mm/mincore.c | 2 +-
mm/mremap.c | 2 +-
21 files changed, 1542 insertions(+), 157 deletions(-)
create mode 100644 arch/riscv/mm/contpte.c
base-commit: b8809969e1d7a591e0f49dd464a5d04b3cf02ab1
--
2.39.5
next reply other threads:[~2026-07-16 12:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 12:41 Yunhui Cui [this message]
2026-07-16 12:41 ` [PATCH v2 01/15] riscv: introduce raw PTE helpers Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 02/15] riscv: switch arch page-table users to " Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 03/15] riscv/mm: implement Svnapot contpte read-side helpers Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 04/15] riscv/mm: implement Svnapot contpte update helpers Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 05/15] mm: extend pte batch and leaf-size helpers Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 06/15] riscv: make pte_batch_hint() honor folio batch flags Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 07/15] riscv/mm: preserve Svnapot leaf-size semantics for page-table consumers Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 08/15] riscv/mm: avoid redundant Svnapot A/D aggregation Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 09/15] riscv/mm: avoid Svnapot consistency checks in ptep_get() Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 10/15] mm/gup: add fast-GUP specific lockless PTE helpers Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 11/15] riscv: mm: avoid Svnapot A/D aggregation in fast-GUP Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 12/15] arm64: mm: avoid contpte " Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 13/15] riscv/mm: remove redundant TLB flush in napotpte_convert Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 14/15] riscv/mm: optimize mprotect for Svnapot mappings Yunhui Cui
2026-07-16 12:41 ` [PATCH v2 15/15] riscv: mm: Request large exec folios for Svnapot Yunhui Cui
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=cover.1784201104.git.cuiyunhui@bytedance.com \
--to=cuiyunhui@bytedance.com \
--cc=kasan-dev@googlegroups.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.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