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 4F2FC606A33C for ; Tue, 1 Dec 2026 09:48:40 +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=WCX4lFA5; 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=sp6WFv5d 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=P0B8h04vGWelpo+4QUEUso9uzU/0YGmKZMnfmtzMa9I=; b=WCX4lFA5DNOPf04Oxtq3T+dvvQ X7FxNQPZBYXw9RJYBLRSmyaaVKiOY+2yX0Kok8f99YVacmBWdyurolvx9tTwTFiFkx1npTNhuqz5T 2IlnyHQmjYtN3jU90y7dRrBE16ZhA6Y/ppoCQrAxHsjdC7uaPZHFR4NbBf4ZLVxHmkPNII7GK3FtK Mw1a2xn9B8UVxYQ2JlYFbecJX6yHxfU3PV0IHNbDxkxJ38MXS9IuKAuV2Y0WLwoYSg6gDHsfTi2r4 Vb06OE9cReLw8/Mj6/vOVy8pD50TpinzTIu1DIjHgpsWE1/4HwQuQSL6qiNe48UyvWG+mwZCOsdJS fzcqhFeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYKTX-00000007Fn7-1QLK; Tue, 01 Dec 2026 09:48:39 +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 1xYKTT-00000007Flx-1P1J; Tue, 01 Dec 2026 09:48:37 +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 0558D14BF; Tue, 1 Dec 2026 01:48:29 -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 6409B3F7D8; Tue, 1 Dec 2026 01:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796118511; bh=gi7tNZ4VdyEcfq2jlO7BNf9xmGHJFup8YLVRu1tfifs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sp6WFv5dwtp8D20ZnB2y/btL6gkPrB+PBsUez9gYEkzKT5jaP4tM6aMIVcpg6Lc83 6TreTlYDmg5vxm3CUTZZ+IDtU89MokDfDj0jMHBWEBqo4TTuLukHiBsQ6/sul+FQNY TOburUHJngwcQYSvq2OUxRhKM3PKU9O4pxoBuaTg= Date: Tue, 1 Dec 2026 09:48:20 +0000 From: Yeoreum Yun To: Andrew Morton Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , 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 , Mike Rapoport , 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, stable@vger.kernel.org, Sohil Mehta Subject: Re: [PATCH v3 00/20] mm: change behavior of pXdp_get()/pXd_page() in compile-time folded pgtable Message-ID: References: <20261130-dummy_ptxp3-v3-0-456081a8ed0e@arm.com> <20261130160513.b6c6fc2c27f764dc2dd96ee0@linux-foundation.org> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20261130160513.b6c6fc2c27f764dc2dd96ee0@linux-foundation.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_014835_457051_2C62D0A9 X-CRM114-Status: GOOD ( 17.37 ) X-Spam-Score: -4.4 (----) X-BeenThere: kvm-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: "kvm-riscv" X-Spam-Status: No, score=-8.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, 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 Mon, Nov 30, 2026 at 04:05:13PM -0800, Andrew Morton wrote: > On Mon, 30 Nov 2026 17:18:33 +0000 Yeoreum Yun wrote: > > > Using ptep_get() and its counterparts in common code is suboptimal on > > kernel configurations with generic compile-time folded page tables. > > By default, ptep_get() and its friends expands to READ_ONCE(), > > forcing the compiler to emit a load even when the value is not used afterwards. > > > > lazy drive-by comment: > > > Documentation/mm/page_tables.rst | 84 +++++++++++++++++++++++++---- > > arch/arm/include/asm/page-nommu.h | 4 +- > > arch/arm/include/asm/pgtable-2level-types.h | 20 +++++-- > > arch/arm/include/asm/pgtable.h | 2 - > > arch/arm64/include/asm/pgtable.h | 23 -------- > > arch/loongarch/include/asm/pgtable.h | 2 + > > arch/loongarch/kvm/mmu.c | 20 ++++--- > > arch/mips/include/asm/pgtable.h | 2 + > > arch/openrisc/include/asm/pgtable.h | 3 -- > > arch/riscv/kvm/mmu.c | 20 ++++--- > > arch/riscv/mm/fault.c | 52 +++++++++++------- > > arch/x86/include/asm/pgtable.h | 14 +++++ > > arch/x86/kernel/cpu/common.c | 2 +- > > arch/x86/kernel/machine_kexec_64.c | 2 +- > > arch/x86/mm/dump_pagetables.c | 18 ++++--- > > arch/x86/mm/init.c | 2 +- > > arch/x86/mm/pat/set_memory.c | 6 +-- > > include/asm-generic/pgtable-nop4d.h | 54 +++++++++++++++---- > > include/asm-generic/pgtable-nopmd.h | 54 +++++++++++++++---- > > include/asm-generic/pgtable-nopud.h | 56 +++++++++++++++---- > > include/linux/pgtable.h | 69 +++++++++++++++++------- > > 21 files changed, 369 insertions(+), 140 deletions(-) > > afaict, this series is an unquantified speed/.text improvement? That's > a lot of churn! What actual benefit are we getting from it? Actually, this patch series is not expected to bring significant improvements in overall performance or .text size. Rather, it is a preparatory step towards replacing direct page table accesses, such as direct dereferences or READ_ONCE(), with the standard accessor pXdp_get() [1]. Therefore, while there are no significant overall improvements or regressions, individual functions benefit from the removal of suboptimal code. For example, on arm64 with CONFIG_PGTABLE_LEVELS=3, I measured the performance 10 times using perf after applying this series, comparing the results against mm-core/for-next: +----------------------------+-------------+------------------+ | function | size change | exec time change | +----------------------------+-------------+------------------+ | perf_get_page_size | -3.00% | -2.10% | | walk_pgd_range | -1.37% | -1.70% | | __apply_to_page_range | -1.23% | -0.23% | +----------------------------+-------------+------------------+ Thanks! Link: [1] https://lore.kernel.org/all/0019d675-ce3d-4a5c-89ed-f126c45145c9@kernel.org/ -- Sincerely, Yeoreum Yun -- kvm-riscv mailing list kvm-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kvm-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796118513; b=mYIq6VyGuvMdRf5N4ZuU5EmT5G3Y7LKsStTUT/dwYUL8gYc8O4Vj74YF7lwpOasfZ1Ly g+l6WYEdEz3FufRWllLuIJvuCrOHjzDpGxh9xtwfwREIEGPyKmyYVapRvsm0F0hQ/8/wF mJVVfGyMBbtelRHaPq+wgRuoAVagcF2oJrY3jKZ/WBQ8L6VktBhGaUoh614URwn28lSee 6fU2TmSdIC95vYd9bPj45nb+qNSwdXfPnrxi+QnhRxmIaNaojL7INKgex+OpIZ8PHfDFU K1xTdXOGsMY255d7zdO6Fu+INNsDffXRiqlWaZ3P5ecN7vHvpMBMcEDM4wcIdC8M7cA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796118513; h=DMARC-Filter:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=2ny7QRAdHvygVfN4Wj/IWABOLFxK8eyFAbrtRmg+wRQ=; b=kdEeUaHCecNt8jdpX8aUze11LnBqQAunLuIFo0+WTgzYWwEihCz5ApBaE+hjOVrnrxln 5Eu/E4zXVt7bBHn5oQ/fPoaOhTPlyX/3UUNYwRWpdX+C3kA6txusk6IZoNIlAK19fCOUH NMP6/2PCDtdXwtGnpvIApLjSPbVNxcdOYIpbcQgs/LbhlpfzgvISvyfy+BI10Yrk8WXQI E2HOKgzcGag3/f9VIHNwnWB/EpMeHdy8GFUokaQe1SDsPf+ZcjlYFfZoEaeG8vZ5tCvUh OQ8EDdlGvayUCylCBKXEEEDFiVMe9Z7HkpP056DPEqPA6DnsHbyB+cMe/w6J2oLGqhw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=sp6WFv5d; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFEFC606A33B; Tue, 1 Dec 2026 09:48:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CFEFC606A33B 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.a=rsa-sha256 header.s=foss header.b=sp6WFv5d 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 0558D14BF; Tue, 1 Dec 2026 01:48:29 -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 6409B3F7D8; Tue, 1 Dec 2026 01:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796118511; bh=gi7tNZ4VdyEcfq2jlO7BNf9xmGHJFup8YLVRu1tfifs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sp6WFv5dwtp8D20ZnB2y/btL6gkPrB+PBsUez9gYEkzKT5jaP4tM6aMIVcpg6Lc83 6TreTlYDmg5vxm3CUTZZ+IDtU89MokDfDj0jMHBWEBqo4TTuLukHiBsQ6/sul+FQNY TOburUHJngwcQYSvq2OUxRhKM3PKU9O4pxoBuaTg= Date: Tue, 1 Dec 2026 09:48:20 +0000 From: Yeoreum Yun To: Andrew Morton Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , 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 , Mike Rapoport , 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, stable@vger.kernel.org, Sohil Mehta Subject: Re: [PATCH v3 00/20] mm: change behavior of pXdp_get()/pXd_page() in compile-time folded pgtable Message-ID: References: <20261130-dummy_ptxp3-v3-0-456081a8ed0e@arm.com> <20261130160513.b6c6fc2c27f764dc2dd96ee0@linux-foundation.org> X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130160513.b6c6fc2c27f764dc2dd96ee0@linux-foundation.org> On Mon, Nov 30, 2026 at 04:05:13PM -0800, Andrew Morton wrote: > On Mon, 30 Nov 2026 17:18:33 +0000 Yeoreum Yun wrote: > > > Using ptep_get() and its counterparts in common code is suboptimal on > > kernel configurations with generic compile-time folded page tables. > > By default, ptep_get() and its friends expands to READ_ONCE(), > > forcing the compiler to emit a load even when the value is not used afterwards. > > > > lazy drive-by comment: > > > Documentation/mm/page_tables.rst | 84 +++++++++++++++++++++++++---- > > arch/arm/include/asm/page-nommu.h | 4 +- > > arch/arm/include/asm/pgtable-2level-types.h | 20 +++++-- > > arch/arm/include/asm/pgtable.h | 2 - > > arch/arm64/include/asm/pgtable.h | 23 -------- > > arch/loongarch/include/asm/pgtable.h | 2 + > > arch/loongarch/kvm/mmu.c | 20 ++++--- > > arch/mips/include/asm/pgtable.h | 2 + > > arch/openrisc/include/asm/pgtable.h | 3 -- > > arch/riscv/kvm/mmu.c | 20 ++++--- > > arch/riscv/mm/fault.c | 52 +++++++++++------- > > arch/x86/include/asm/pgtable.h | 14 +++++ > > arch/x86/kernel/cpu/common.c | 2 +- > > arch/x86/kernel/machine_kexec_64.c | 2 +- > > arch/x86/mm/dump_pagetables.c | 18 ++++--- > > arch/x86/mm/init.c | 2 +- > > arch/x86/mm/pat/set_memory.c | 6 +-- > > include/asm-generic/pgtable-nop4d.h | 54 +++++++++++++++---- > > include/asm-generic/pgtable-nopmd.h | 54 +++++++++++++++---- > > include/asm-generic/pgtable-nopud.h | 56 +++++++++++++++---- > > include/linux/pgtable.h | 69 +++++++++++++++++------- > > 21 files changed, 369 insertions(+), 140 deletions(-) > > afaict, this series is an unquantified speed/.text improvement? That's > a lot of churn! What actual benefit are we getting from it? Actually, this patch series is not expected to bring significant improvements in overall performance or .text size. Rather, it is a preparatory step towards replacing direct page table accesses, such as direct dereferences or READ_ONCE(), with the standard accessor pXdp_get() [1]. Therefore, while there are no significant overall improvements or regressions, individual functions benefit from the removal of suboptimal code. For example, on arm64 with CONFIG_PGTABLE_LEVELS=3, I measured the performance 10 times using perf after applying this series, comparing the results against mm-core/for-next: +----------------------------+-------------+------------------+ | function | size change | exec time change | +----------------------------+-------------+------------------+ | perf_get_page_size | -3.00% | -2.10% | | walk_pgd_range | -1.37% | -1.70% | | __apply_to_page_range | -1.23% | -0.23% | +----------------------------+-------------+------------------+ Thanks! Link: [1] https://lore.kernel.org/all/0019d675-ce3d-4a5c-89ed-f126c45145c9@kernel.org/ -- Sincerely, Yeoreum Yun 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 8E156606A32D for ; Tue, 1 Dec 2026 09:49:11 +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=n+n8/3rB; 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=sp6WFv5d 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=whM5ohMBG7kihSG1mwlECIv9ZArYSOmvaYgOLGvWIdI=; b=n+n8/3rBvJASgXNqAy8e3dzJ0R /e10mZaXtl5oFXBD/iY2HvfoOhczuPAP2O69L7cZ/nVOw+8VbewrLNQ40jy5lX20IXqHlknvdMOWg BZAYeT3mJoy5ykeBLVCRS2ejj/oCjN+eyrwVgIzLBRUIOoouj7Q1NY7bEC7ZtyM5ccXO/Tl1Vly9S 8kEUY4t6cnxaTkLzuwlxxBXINwprzbL5JV9twVi6ZHPSiq1toCeEZhh2OTSUSAPzKLQHHHnkdqZBT 7WFoIkQ/EJWrJYwLokI92Fphk0TOeT2Jw0us5KvTXqKoO9t6sn9BDDo9B8nJVbem83QngXVXTQXni 6q9jp9HQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYKTZ-00000007Fni-0DbZ; Tue, 01 Dec 2026 09:48:42 +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 1xYKTT-00000007Flx-1P1J; Tue, 01 Dec 2026 09:48:37 +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 0558D14BF; Tue, 1 Dec 2026 01:48:29 -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 6409B3F7D8; Tue, 1 Dec 2026 01:48:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796118511; bh=gi7tNZ4VdyEcfq2jlO7BNf9xmGHJFup8YLVRu1tfifs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sp6WFv5dwtp8D20ZnB2y/btL6gkPrB+PBsUez9gYEkzKT5jaP4tM6aMIVcpg6Lc83 6TreTlYDmg5vxm3CUTZZ+IDtU89MokDfDj0jMHBWEBqo4TTuLukHiBsQ6/sul+FQNY TOburUHJngwcQYSvq2OUxRhKM3PKU9O4pxoBuaTg= Date: Tue, 1 Dec 2026 09:48:20 +0000 From: Yeoreum Yun To: Andrew Morton Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , 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 , Mike Rapoport , 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, stable@vger.kernel.org, Sohil Mehta Subject: Re: [PATCH v3 00/20] mm: change behavior of pXdp_get()/pXd_page() in compile-time folded pgtable Message-ID: References: <20261130-dummy_ptxp3-v3-0-456081a8ed0e@arm.com> <20261130160513.b6c6fc2c27f764dc2dd96ee0@linux-foundation.org> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20261130160513.b6c6fc2c27f764dc2dd96ee0@linux-foundation.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_014835_457051_2C62D0A9 X-CRM114-Status: GOOD ( 17.37 ) 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=-8.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, 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 Mon, Nov 30, 2026 at 04:05:13PM -0800, Andrew Morton wrote: > On Mon, 30 Nov 2026 17:18:33 +0000 Yeoreum Yun wrote: > > > Using ptep_get() and its counterparts in common code is suboptimal on > > kernel configurations with generic compile-time folded page tables. > > By default, ptep_get() and its friends expands to READ_ONCE(), > > forcing the compiler to emit a load even when the value is not used afterwards. > > > > lazy drive-by comment: > > > Documentation/mm/page_tables.rst | 84 +++++++++++++++++++++++++---- > > arch/arm/include/asm/page-nommu.h | 4 +- > > arch/arm/include/asm/pgtable-2level-types.h | 20 +++++-- > > arch/arm/include/asm/pgtable.h | 2 - > > arch/arm64/include/asm/pgtable.h | 23 -------- > > arch/loongarch/include/asm/pgtable.h | 2 + > > arch/loongarch/kvm/mmu.c | 20 ++++--- > > arch/mips/include/asm/pgtable.h | 2 + > > arch/openrisc/include/asm/pgtable.h | 3 -- > > arch/riscv/kvm/mmu.c | 20 ++++--- > > arch/riscv/mm/fault.c | 52 +++++++++++------- > > arch/x86/include/asm/pgtable.h | 14 +++++ > > arch/x86/kernel/cpu/common.c | 2 +- > > arch/x86/kernel/machine_kexec_64.c | 2 +- > > arch/x86/mm/dump_pagetables.c | 18 ++++--- > > arch/x86/mm/init.c | 2 +- > > arch/x86/mm/pat/set_memory.c | 6 +-- > > include/asm-generic/pgtable-nop4d.h | 54 +++++++++++++++---- > > include/asm-generic/pgtable-nopmd.h | 54 +++++++++++++++---- > > include/asm-generic/pgtable-nopud.h | 56 +++++++++++++++---- > > include/linux/pgtable.h | 69 +++++++++++++++++------- > > 21 files changed, 369 insertions(+), 140 deletions(-) > > afaict, this series is an unquantified speed/.text improvement? That's > a lot of churn! What actual benefit are we getting from it? Actually, this patch series is not expected to bring significant improvements in overall performance or .text size. Rather, it is a preparatory step towards replacing direct page table accesses, such as direct dereferences or READ_ONCE(), with the standard accessor pXdp_get() [1]. Therefore, while there are no significant overall improvements or regressions, individual functions benefit from the removal of suboptimal code. For example, on arm64 with CONFIG_PGTABLE_LEVELS=3, I measured the performance 10 times using perf after applying this series, comparing the results against mm-core/for-next: +----------------------------+-------------+------------------+ | function | size change | exec time change | +----------------------------+-------------+------------------+ | perf_get_page_size | -3.00% | -2.10% | | walk_pgd_range | -1.37% | -1.70% | | __apply_to_page_range | -1.23% | -0.23% | +----------------------------+-------------+------------------+ Thanks! Link: [1] https://lore.kernel.org/all/0019d675-ce3d-4a5c-89ed-f126c45145c9@kernel.org/ -- Sincerely, Yeoreum Yun _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv