Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	David Hildenbrand <david@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/mm: Rename PGD_SIZE as PGD_TABLE_SIZE
Date: Thu, 16 Jul 2026 10:08:55 +0530	[thread overview]
Message-ID: <257fddcd-54f5-41b9-9b0e-9e3db5df74fb@arm.com> (raw)
In-Reply-To: <aleDbfbBpFmXVZJH@willie-the-truck>



On 15/07/26 6:26 PM, Will Deacon wrote:
> 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@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Ryan Roberts <ryan.roberts@arm.com>
>> Cc: David Hildenbrand (Arm) <david@kernel.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>>  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.

Agreed that PGDIR_SHIFT/SIZE is the true source of this inconsistency
deviating from all other pgtable level's macros expressing an address
range. But this above PGD_SIZE based confusion is specific (but then
well contained) inside arm and arm64 platforms.

Changing PGDIR_[SHIFT|SIZE] on all platforms to PGD_[SHIFT|SIZE] and
then converting arm and arm64 platform's PGD_SIZE as PGDIR_SIZE might
be a better solution. But as suggested will just drop this for now.


      reply	other threads:[~2026-07-16  4:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  4:30 [PATCH] arm64/mm: Rename PGD_SIZE as PGD_TABLE_SIZE Anshuman Khandual
2026-07-15 12:56 ` Will Deacon
2026-07-16  4:38   ` Anshuman Khandual [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=257fddcd-54f5-41b9-9b0e-9e3db5df74fb@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=david@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox