Re: [PATCH] arm64/mm: Rename PGD_SIZE as PGD_TABLE_SIZE

From: Will Deacon

Date: Wed Jul 15 2026 - 09:08:54 EST


On Tue, Jul 14, 2026 at 10:00:50AM +0530, Anshuman Khandual wrote:
> PXD_SIZE represents the virtual address range size covered by a single page
> table entry on a given page table level. On arm64 PGD entry address span is
> represented with PGDIR_XXX macros instead while PGD_SIZE has been referring
> to size of the PGD table itself. So PGD_SIZE has been some what confusing.
>
> Rename PGD_SIZE as PGD_TABLE_SIZE making it explicit that it represents PGD
> table size rather than virtual address range covered by a single PGD entry.
> While here, also move PGD_TABLE_SIZE inside pgtable-hwdef.h header.
>
> No functional change.
>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> Cc: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> arch/arm64/include/asm/pgalloc.h | 2 --
> arch/arm64/include/asm/pgtable-hwdef.h | 1 +
> arch/arm64/mm/mmu.c | 2 +-
> arch/arm64/mm/pgd.c | 6 +++---
> 4 files changed, 5 insertions(+), 6 deletions(-)

I'm not disagreeing that we have an inconsistency here, but does this
patch series help in any meaningful way? Firstly, folks are probably
pretty used to the current (inconsistent) terminology by now and,
secondly, I think the main problem is that we have both PGDIR* and PGD*
based constants, so adding a PGD_TABLE_SIZE just makes things more
confusing. Worse, this exists even in core code:

include/linux/pgtable.h:
#define pgd_index(a) (((a) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))

so I would argue that, if you wanted to repaint all of this, that would
be the place to start, not by making the arm64 even weirder.

Personally, though, I'd leave it all alone because I not a big fan of
this sort of churn in isolation.

Will