Re: [PATCH v3 00/20] mm: change behavior of pXdp_get()/pXd_page() in compile-time folded pgtable
From: Yeoreum Yun
Date: Tue Dec 01 2026 - 04:48:39 EST
On Mon, Nov 30, 2026 at 04:05:13PM -0800, Andrew Morton wrote:
> On Mon, 30 Nov 2026 17:18:33 +0000 Yeoreum Yun <yeoreum.yun@xxxxxxx> wrote:
>
> > Using ptep_get() and its counterparts in common code is suboptimal on
> > kernel configurations with generic compile-time folded page tables.
> > By default, ptep_get() and its friends expands to READ_ONCE(),
> > forcing the compiler to emit a load even when the value is not used afterwards.
> >
>
> lazy drive-by comment:
>
> > Documentation/mm/page_tables.rst | 84 +++++++++++++++++++++++++----
> > arch/arm/include/asm/page-nommu.h | 4 +-
> > arch/arm/include/asm/pgtable-2level-types.h | 20 +++++--
> > arch/arm/include/asm/pgtable.h | 2 -
> > arch/arm64/include/asm/pgtable.h | 23 --------
> > arch/loongarch/include/asm/pgtable.h | 2 +
> > arch/loongarch/kvm/mmu.c | 20 ++++---
> > arch/mips/include/asm/pgtable.h | 2 +
> > arch/openrisc/include/asm/pgtable.h | 3 --
> > arch/riscv/kvm/mmu.c | 20 ++++---
> > arch/riscv/mm/fault.c | 52 +++++++++++-------
> > arch/x86/include/asm/pgtable.h | 14 +++++
> > arch/x86/kernel/cpu/common.c | 2 +-
> > arch/x86/kernel/machine_kexec_64.c | 2 +-
> > arch/x86/mm/dump_pagetables.c | 18 ++++---
> > arch/x86/mm/init.c | 2 +-
> > arch/x86/mm/pat/set_memory.c | 6 +--
> > include/asm-generic/pgtable-nop4d.h | 54 +++++++++++++++----
> > include/asm-generic/pgtable-nopmd.h | 54 +++++++++++++++----
> > include/asm-generic/pgtable-nopud.h | 56 +++++++++++++++----
> > include/linux/pgtable.h | 69 +++++++++++++++++-------
> > 21 files changed, 369 insertions(+), 140 deletions(-)
>
> afaict, this series is an unquantified speed/.text improvement? That's
> a lot of churn! What actual benefit are we getting from it?
Actually, this patch series is not expected to bring significant
improvements in overall performance or .text size.
Rather, it is a preparatory step towards replacing direct page table
accesses, such as direct dereferences or READ_ONCE(), with
the standard accessor pXdp_get() [1].
Therefore, while there are no significant overall improvements or
regressions, individual functions benefit from the removal of suboptimal code.
For example, on arm64 with CONFIG_PGTABLE_LEVELS=3, I measured
the performance 10 times using perf after applying this series,
comparing the results against mm-core/for-next:
+----------------------------+-------------+------------------+
| function | size change | exec time change |
+----------------------------+-------------+------------------+
| perf_get_page_size | -3.00% | -2.10% |
| walk_pgd_range | -1.37% | -1.70% |
| __apply_to_page_range | -1.23% | -0.23% |
+----------------------------+-------------+------------------+
Thanks!
Link: [1] https://lore.kernel.org/all/0019d675-ce3d-4a5c-89ed-f126c45145c9@xxxxxxxxxx/
--
Sincerely,
Yeoreum Yun