From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C26AB370AC7 for ; Thu, 16 Jul 2026 04:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784176743; cv=none; b=azUWyvKSaZU9283EqItH72bGuytJmUhdYF4TMIhLvCEPPoOyeDz0DFu43+logyJxwRAuUws9RMSvTXjkPNg1GhIeGM1vB2+TIhutjYeafxjrjSYd43HyvAbHFNMzJSki42SGWuryJHl1GksImsPOStxAa/3y/LjTcX88J+mlals= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784176743; c=relaxed/simple; bh=uOFRvUWPyKzTO568yVm0wl9rFu1kQ1eDz2t8kl6laR4=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=MCu8SeQaGOM7cOiKPDSJjwK71LwxYaI0clney+W+jw1c47T0cbdlKH65zciM0oTbjHv0OV0g3Qxbtmq7+1+JQpW7XFbAftOo6UNj+2pKGlfE3eAegC4bTZ4FrtxhhvLhQ6MxeRt1kebW9CqnWoVk4vKTNgHQl0qZGog4GFOyjrk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=V4t1218Y; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="V4t1218Y" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB7E61477; Wed, 15 Jul 2026 21:38:55 -0700 (PDT) Received: from [10.163.164.156] (unknown [10.163.164.156]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 304753F7D8; Wed, 15 Jul 2026 21:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784176740; bh=uOFRvUWPyKzTO568yVm0wl9rFu1kQ1eDz2t8kl6laR4=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=V4t1218YkDa4AYANzvOkHJyzNxhpBXmSTOgLr0ED+OKdtJT11bACGeU5tPUsehqkZ 1u8geeIq4KA0EtFS/hMtMTJb6D+dKGxf3wUo86nsfsr5Dt6+KAaz2z2oNT1beRiMFd VDQrWIUOj61gQA4dEV2Q3QOkNNGhC/hX+rJD3C5k= Message-ID: <257fddcd-54f5-41b9-9b0e-9e3db5df74fb@arm.com> Date: Thu, 16 Jul 2026 10:08:55 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Anshuman Khandual Subject: Re: [PATCH] arm64/mm: Rename PGD_SIZE as PGD_TABLE_SIZE To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Ryan Roberts , David Hildenbrand , linux-kernel@vger.kernel.org References: <20260714043050.2984188-1-anshuman.khandual@arm.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 >> Cc: Will Deacon >> Cc: Ryan Roberts >> Cc: David Hildenbrand (Arm) >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> 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.