Re: [PATCH v2 6/7] x86/mm: remove p4d_leaf definition

From: Ingo Molnar
Date: Mon Mar 31 2025 - 05:57:39 EST



* Baoquan He <bhe@xxxxxxxxxx> wrote:

> There's no p4d huge page support yet, let's use the generic definition.
>
> And also update the BUILD_BUG_ON() in pti_user_pagetable_walk_pmd()
> because p4d_leaf() returns boolean value.


> -#define p4d_leaf p4d_leaf
> -static inline bool p4d_leaf(p4d_t p4d)
> -{
> - /* No 512 GiB pages yet */
> - return 0;
> -}

This comment was also incorrect I believe:

1 PTE entry on x86-64 covers 4K virtual memory, 512 PTE entries make up
a 4K pagetable page, and each level of paging adds another level of 512
pagetable entries:

- level 0: 4K pages
- level 1: 512x 4K = 2MB 'large' pages
- level 2: 512x 2MB = 1GB 'huge' pages
- level 3: 512x 1GB = 512GB 'PGD' pages
- level 4: 512x 512GB = 256TB 'P4D' pages

So the above comment should have said '256 TB' pages, unless there's
some naming weirdness I missed.

Thanks,

Ingo