Re: [PATCH] mm: use standard page table accessors

Christophe Leroy (CS GROUP)
2025-11-26T10:28:47Z

Le 26/11/2025 à 11:03, Wei Yang a écrit :
> On Wed, Nov 26, 2025 at 09:15:24AM +0100, Christophe Leroy (CS GROUP) wrote:
>>
>>
>> Le 26/11/2025 à 07:47, Wei Yang a écrit :
>>> Use standard page table accessors i.e pxdp_get() to get the value of
>>> pxdp.
>>
>> Please provide more detail of why you want to do that and how you are sure it
>> doesn't break existing implementation.
>>
>> There was similar tentative in the past already which proved to give
>> suboptimal results, see discussion here:
>>
>> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2Ff40ea8bf-0862-41a7-af19-70bfbd838568%40csgroup.eu%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C63a7608567de4df0a16308de2cd31076%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C638997482180349327%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ly4LRRjkKqQNBY6ZpkbHS7%2B0xuu2c1r0op1eysPtbSQ%3D&reserved=0
>
> Interesting.
>
> The reason is P4D/PUD/PMD on PPC32 actually just has PGD/PMD. So it is not
> necessary to retrieve P4D and PUD.

More exactly, PPC32 just has PGD and PTE, no PMD either:

arch/powerpc/include/asm/book3s/32/pgtable.h:#include
<asm-generic/pgtable-nopmd.h>
arch/powerpc/include/asm/nohash/32/pgtable.h:#include
<asm-generic/pgtable-nopmd.h>

>
> If this is the case, sounds other platform with less pagetable level would be
> affected too.

Indeed.

>
> And this looks only affect when we walk the pagetable from pgd. If we just
> iterating pmd/pte, we won't have this issue, right?

Maybe. I have not looked at your changes in details, it just lit up a
memory in my mind.

Christophe