From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC14F606A680 for ; Tue, 24 Nov 2026 18:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EXQJRGp1; dkim=fail reason="signature verification failed" (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=HxpQmHpN DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=Bnxxz0tnOvX4x1j34qP5ILgM7t8mwAW5kmyYme3cTh4=; b=EXQJRGp1NBf269ejh9OuXtZkVy t+1OuCsY219tlveBs4GLhd/VvKK/smdYosUP1IxrfDEThCSML7qwQI0VsESw1wwnhTfRZjITGvViC vCPGlBObYFJx+htpzcHpR4fFnUz8Cq6mDcV+TsOMANjo37GQ2dNYIbOKNeKz9FGBLnEcGXYKUrJT2 ey+VQ+RwEbqsvQw3ZPeQEU9ctObC1YoHeN86NUS/wQ0H5cPyrqiPMJq14XcnGdGwm3DQsn99VIcle 273BLFC21IegWCKmnvMRaKWLCdUSpGJVCVXkLPYtDeeEtcKemMivJD2RnifSGsfICu+LPMmRaF2Ft 2s7ITi4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVvcn-00000007Y3S-21Zi; Tue, 24 Nov 2026 18:52:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVvcj-00000007Y15-3jdi; Tue, 24 Nov 2026 18:52:15 +0000 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 1019F497; Tue, 24 Nov 2026 10:52:08 -0800 (PST) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7EAC33F86C; Tue, 24 Nov 2026 10:52:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1795546330; bh=cEx0NNr4v9OqxertlfeaIBCZsjK0gqeBlEmSznQ0QE4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HxpQmHpNrqXVqUfjE0HPfLK3ewOjjeolAx23daMcxTI88aKM+hL6rA2Fg+4rqd8+R qMFVk/rzRBXFpbU1Dfr/ftkZEjuXw3RMnNovsFD1RM3+rwaFKpdU0NBWTD4cVkNWWE Ki55UEoYDf7IlCgUAL9LE2jIQWyjvIsSNBfWze2I= Date: Tue, 24 Nov 2026 18:52:00 +0000 From: Yeoreum Yun To: Mike Rapoport Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Tianrui Zhao , Bibo Mao , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Liam R. Howlett" , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Jonas Bonn , Stefan Kristiansson , Stafford Horne , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-openrisc@vger.kernel.org Subject: Re: [PATCH RESEND v2 12/21] mm/pgtable: redefine PGTABLE_LEVEL enum with ascend order from PGD Message-ID: References: <20261102-dummy_ptxp3-v2-0-78840b2ec73c@arm.com> <20261102-dummy_ptxp3-v2-12-78840b2ec73c@arm.com> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261124_105214_015127_99A6788E X-CRM114-Status: GOOD ( 24.86 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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. > > > For consistency and cleanup, reverse the enum value ordering. > > > > Since there is no current user relies on these numbers to be ascending from > > PTE->PGD, so it can be changed to be ascending from PGD->PTE, in the > > direction of the page table walk. > > > > Reviewed-by: David Hildenbrand (Arm) > > Signed-off-by: Yeoreum Yun > > --- > > include/linux/pgtable.h | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > > index 780fe849ff8b7..a032f95943357 100644 > > --- a/include/linux/pgtable.h > > +++ b/include/linux/pgtable.h > > @@ -2288,11 +2288,11 @@ static inline bool arch_has_pfn_modify_check(void) > > typedef unsigned int pgtbl_mod_mask; > > > > enum pgtable_level { > > - PGTABLE_LEVEL_PTE = 0, > > - PGTABLE_LEVEL_PMD, > > - PGTABLE_LEVEL_PUD, > > + PGTABLE_LEVEL_PGD = 0, > > PGTABLE_LEVEL_P4D, > > - PGTABLE_LEVEL_PGD, > > + PGTABLE_LEVEL_PUD, > > + PGTABLE_LEVEL_PMD, > > + PGTABLE_LEVEL_PTE, > > }; > > > > static inline const char *pgtable_level_to_str(enum pgtable_level level) > > > > -- > > 2.43.0 > > > > -- > Sincerely yours, > Mike. -- Sincerely, Yeoreum Yun _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv