Re: [PATCH v3 00/20] mm: change behavior of pXdp_get()/pXd_page() in compile-time folded pgtable

From: David Hildenbrand (Arm)

Date: Tue Dec 01 2026 - 07:53:00 EST


On Mon, 30 Nov 2026 17:18:33 +0000, Yeoreum Yun 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.
>
> This issue was recently reported by Christophe Leroy [1] for ppc32
> preventing futher code conversion to ptep_get()/pmdp_get()/... helper
> and the same behavior can also be observed on arm64 when built with
> 2- or 3-level page tables
>
> [...]

I fixed up all things I reported (commit messages, cover letter in merge
commit, smaller fixups) and pushed it to a topic branch to give it
some exposure in -next.

Levi, it would be good to send an official v4. You can see all the fixed
up commits on the branch below.

tree: mm/core.git
branch: core-7.5.folded

Applied patches will appear soon in mm-next, followed by linux-next.

Please report any outstanding bugs that were missed during review, so we
can either drop the patch series or decide how to fix it up.

It is encouraged to provide Acked-bys, Reviewed-bys, and Tested-bys even
though the patches have already been applied. If possible, patch trailers
will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. Further, this is not a guarantee that the
patches will go upstream. If in doubt, please check the listed branch.

[01/20] mm/pgtable: define (pgd|p4d|pud)_offset_lockless() for folded page tables
https://git.kernel.org/mm/core/c/6564cc97
[02/20] ARM: mm: make nommu pgd_t a scalar
https://git.kernel.org/mm/core/c/28d66222
[03/20] ARM: mm: make 2-level pgd_t a scalar
https://git.kernel.org/mm/core/c/4a240a55
[04/20] ARM: mm: remove custom pgdp_get()
https://git.kernel.org/mm/core/c/e84a1737
[05/20] LoongArch: mm: define pud_leaf() only when PUD exists
https://git.kernel.org/mm/core/c/6f717fc7
[06/20] MIPS: mm: define pud_leaf() only when PUD exists
https://git.kernel.org/mm/core/c/e20c807c
[07/20] mm/pgtable: define (pgd|p4d|pud)_leaf() for folded page tables
https://git.kernel.org/mm/core/c/296a08f0
[08/20] loongarch: kvm: remove stack copy address of pXd in pXd_offset()
https://git.kernel.org/mm/core/c/bfa25acc
[09/20] riscv: kvm: remove stack copy address of pXd in pXd_offset()
https://git.kernel.org/mm/core/c/f9d6060a
[10/20] riscv: mm: use proper set_pXd() for generic compile-time folded patable in vmalloc_fault()
https://git.kernel.org/mm/core/c/616c8b83
[11/20] mm/pgtable: redefine PGTABLE_LEVEL enum with ascend order from PGD
https://git.kernel.org/mm/core/c/6097176c
[12/20] x86/mm: Introduce helper for checking direct map 1G page support
https://git.kernel.org/mm/core/c/bc54d4d3
[13/20] x86: mm: use pgtable_level enum in effective_prot_pXd()
https://git.kernel.org/mm/core/c/c7fbc5e3
[14/20] x86: mm: carve out the generic compile-time folded pgtable case in effective_prot()
https://git.kernel.org/mm/core/c/a330dee4
[15/20] openrisc/pgtable: drop __pmd_offset()
https://git.kernel.org/mm/core/c/0a90b8ae
[16/20] mm/pgtable: optimize pmdp_get() and friends for folded pagetable levels
https://git.kernel.org/mm/core/c/cb108376
[17/20] mm/pgtable: catch abuse of folded dummy pgd_t/p4d_t/pud_t
https://git.kernel.org/mm/core/c/3410e8df
[18/20] mm/pgtable: disallow calling (pgd|p4d|pud)_page, pgd_page_vaddr() and (p4d|pud)_pgtable with dummy
https://git.kernel.org/mm/core/c/c0611c1d
[19/20] mm/pgtable: disallow calling folded set_pgd/set_p4d/set_pud with dummy
https://git.kernel.org/mm/core/c/2276a877
[20/20] Documentation: mm: clarify behaviour of compile-time folded page tables
https://git.kernel.org/mm/core/c/20280c60

--
Cheers,

David