Re: [PATCH v3 07/20] mm/pgtable: define (pgd|p4d|pud)_leaf() for folded page tables

From: David Hildenbrand (Arm)

Date: Tue Dec 01 2026 - 07:04:13 EST


On 11/30/26 18:18, Yeoreum Yun wrote:
> From: "David Hildenbrand (Arm)" <david@xxxxxxxxxx>
>
> Define (pgd|p4d|pud)_leaf(), hard-coding it to "false". Note
> that it's missed to define pud_leaf() before, allowing architectures to
> unknowingly overwrite it.
>
> Still use static inline functions (type checking), and while at it, just
> use "bool" as a return value.
>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> ---
> include/asm-generic/pgtable-nop4d.h | 3 +++
> include/asm-generic/pgtable-nopmd.h | 3 ++-
> include/asm-generic/pgtable-nopud.h | 3 +++
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h
> index 9a912545a7b92..019c3f074b771 100644
> --- a/include/asm-generic/pgtable-nop4d.h
> +++ b/include/asm-generic/pgtable-nop4d.h
> @@ -22,6 +22,9 @@ static inline int pgd_none(pgd_t pgd) { return 0; }
> static inline int pgd_bad(pgd_t pgd) { return 0; }
> static inline int pgd_present(pgd_t pgd) { return 1; }
> static inline void pgd_clear(pgd_t *pgd) { }
> +static inline bool pgd_leaf(pgd_t pgd) { return false; }
> +#define pgd_leaf pgd_leaf
> +#define p4d_ERROR(p4d) (pgd_ERROR((p4d).pgd))

I think p4d_ERROR etc is gone now, so we should drop all of them in this patch.

--
Cheers,

David