Re: [PATCH RESEND v2 12/21] mm/pgtable: redefine PGTABLE_LEVEL enum with ascend order from PGD

From: David Hildenbrand (Arm)

Date: Thu Nov 26 2026 - 09:19:41 EST


On 11/24/26 19:52, Yeoreum Yun wrote:
> On Tue, Nov 24, 2026 at 07:05:38PM +0200, Mike Rapoport wrote:
>> On Mon, Nov 02, 2026 at 11:21:25AM +0000, Yeoreum Yun wrote:
>>> The PGTABLE_LEVEL enum values appear to be ordered in the opposite direction
>>> from their intended usage.
>>>
>>> Intuitively, higher page table levels should have smaller enum values,
>>> but PTE is currently assigned 0.
>>
>> That's not what x86 thinks :)
>> They even expose it in /proc/vmstat with smaller numbers meaning lower levels
>>
>> $ grep direct_map /proc/vmstat
>> direct_map_level2_splits 152
>> direct_map_level3_splits 4
>> direct_map_level2_collapses 0
>> direct_map_level3_collapses 0
>>
>> Just an observation, I don't mind either order.
>
> Right. I made this change because a depth-based scheme seems more intuitive.
>
> As you pointed out, though, the x86 specification uses smaller
> numbers (0) for lower levels (pte), so I think we can leave the
> x86-specific direct_map_* entries as they are.

patch #14 depends on this, no?

--
Cheers,

David