From patchwork Fri Jan 3 18:44:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 13925789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D62FE77188 for ; Fri, 3 Jan 2025 18:44:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4DD36B0092; Fri, 3 Jan 2025 13:44:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FD066B0093; Fri, 3 Jan 2025 13:44:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C4F76B0095; Fri, 3 Jan 2025 13:44:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6F4AE6B0092 for ; Fri, 3 Jan 2025 13:44:32 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F1E6480241 for ; Fri, 3 Jan 2025 18:44:31 +0000 (UTC) X-FDA: 82967016342.16.A05C1F3 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf24.hostedemail.com (Postfix) with ESMTP id 2E942180009 for ; Fri, 3 Jan 2025 18:44:29 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735929870; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=ZontuwCoinBEbae73Q0bAKKpV+MGIErfthpPUUzIUcI=; b=MIxeXTy0Iog2KxJipqnpqBiKGIxBNNd9k7Np0/Gr0dUMH3VtNUWcoQ183EP56KQ/CItcE5 u/QqJrS8vuZuWIJsy6vrdsvuBdBrDN2yub5bZBbwDNaPiOiiKzfZUL+aR3lFhjcXWWYqVR gXnPb46jAdMma46t2NGjH2u2NiYNqPI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735929870; a=rsa-sha256; cv=none; b=6Thd1rmVqX8Y+lYngW4GGFzAMHJ1Pyc7Ar2l38FkxqWMri6OiV9lL+/D6EXUgh73qcyxLv QQS1LlwMDxNLU6+UW8M5IWPM4YqrXkpEDJCXb+GXJ51NwX36BAJ5MzSz8M1fUv82OuP2AJ uGdBj0ve0pwRw8HWpawn4B+DXBT2Zp8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com; dmarc=pass (policy=none) header.from=arm.com 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 561C61480; Fri, 3 Jan 2025 10:44:57 -0800 (PST) Received: from e123572-lin.arm.com (e123572-lin.cambridge.arm.com [10.1.194.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D3DB3F673; Fri, 3 Jan 2025 10:44:24 -0800 (PST) From: Kevin Brodsky To: linux-mm@kvack.org Cc: Kevin Brodsky , Andrew Morton , Catalin Marinas , Dave Hansen , Linus Walleij , Andy Lutomirski , Peter Zijlstra , "Mike Rapoport (IBM)" , Ryan Roberts , Thomas Gleixner , Will Deacon , Matthew Wilcox , Qi Zheng , linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, loongarch@lists.linux.dev, x86@kernel.org Subject: [PATCH v2 0/6] Account page tables at all levels Date: Fri, 3 Jan 2025 18:44:09 +0000 Message-ID: <20250103184415.2744423-1-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2E942180009 X-Stat-Signature: j3yiybf31rt45mm8sfp8uhjqoemeg35k X-Rspam-User: X-HE-Tag: 1735929869-743407 X-HE-Meta: U2FsdGVkX1+J4dJ5GSDjr7pKSMBbSiLWyVxqSlm/70bu6o1yRYttdOUhMmLK8wovUWzQuXMXHpd1FykybclFjjcnuDYrz7d8YUw9AeqiZXkQpBFhaPRJol5ekMmhI1l4DOcKrA9ab6RJga9g1AUOfstP23+9vDnrIJxbo2ZFr+lb986ac6YE+4pcxC3uc48Hv7k4cTWvR+YyUr7zrz+NJTKa8+o6/9V2olw1BqyO8eBtAY/g+eZpm7hgqVwS5aIrGm8+n4MyU72sKmjA0vSecLHfZmooDlAtVhlylCzX4l3tD2hUc3o+hFekh2EruljsTVKiv38xejfcmlmwAcLP2PryHJEx25cCl+CijYcRrBLNk18a1poDm38qeT7G2B/9EtMRM+VWY39/qtrQlX3okA7dxe3uH8S3Ynrs0V1Gi9CmiMUXkdvIPwtPoSdtvnV5/htOjacSDZ+MXv0R81m7c2pza7GVeuAVUnpqUdhsGnDpemYOXW306hgQRcVBhRBLNc+i/2eAAYo5+aRW67cRJbhuGZnjOS+3rBejYdgJIoObQPlGVYzipt2Kgl1Bd+uBs47vHK2PZG22UfMK0wt4ebm7MLil9n7OO8zGisAAEs7tfXjhTbZ+QZX1j3M01MhdXr35ncOd+tkIQwcjF+N3vaAEH79ono+Jaqwa8iKWejeSA6a1cr2B2zwMQMkKh7D8IP6EfeRseToeQQ2/NhXCkQpUAvArto15MZmnOebfkTI5JB6Wxdi/KYdJrbIbLCh4CFjegVkRhIfcg8iUpzMOnJvqElmRB15sh/YT7438TOIi6y2Ti34kCJQg/DLqsCGeZM97dsuNJpXwPVWiOKsvk0L7f2peGrL7FRjJDlMcesuFSccWuOZJ7chjve+RNl7tIQCLMVOfInb8iyApHdalgqYit3aq3+QlcubEfk7F63SHpBMy2YiDYOKQwluKAxFJY19KxF2lNb2/fjT4NGS VYBVc0uC PkuobdNnWUVQnNfBGBPKMNDaGmmrDP7zEZz/DIZH/uNxl3Ss7jrzEDHEQbjGiNeoVb1KDbUuL4viG19B8WuxpSMo/tP30FpmHCPlB3kOJwWLYsEeNa45mQzC8yrQubVra3CUvGiyThmesrn67QFc5Je/ev7Al2LYAd+2Gs4u13YWzmpvbQgrXVmM0X/AHpk7NDEbI3MANFDLAabGu59yeciqdsbQZouG6TNIWAvvygwrQME9D7rd9lBlAGm4l7zBAvLvg3Thk7CnpL4FstTQWoxqaoY/0lpqZ32dMJ+ltLFuKMApCZzctU9AeDky5yXcINMP2j7LdfKOqss8OQ2jC3J8H/FbYd+8cGQyjoXIs8u1dMwgrC3i2lWJfpYrJmeWs/6ffI+aWYXvd29ElJYErqV1HDr2MAbHZC2wIveI6/nXpLADpSePCxiM69bPUuErvHeyf/oyXAzlMKIFBMQy9dwLu8A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: v1: https://lore.kernel.org/linux-mm/20241219164425.2277022-1-kevin.brodsky@arm.com/ This series should be considered in conjunction with Qi's series [1]. Together, they ensure that page table ctor/dtor are called at all levels (PTE to PGD) and all architectures, where page tables are regular pages. Besides the improvement in accounting and general cleanup, this also create a single place where construction/destruction hooks can be called for all page tables, namely the now-generic pagetable_dtor() introduced by Qi, and __pagetable_ctor() introduced in this series. v2 is essentially v1 rebased on top of mm-unstable, which includes Qi's v4 series. A number of patches from v1 were dropped: * v1 patch 4 is superseded by patch 6 in Qi's series. * v1 patch 5 and 6 moved to Qi's series from v3 onwards. * v1 patch 7 is superseded by patch 4 in Qi's series. Changes from v1 in the remaining patches: * Patch 1 only introduces __pagetable_ctor() as there is now a single generic pagetable_dtor(). * Patch 3 and 6: in arch/m68k/mm/motorola.c, free_pointer_table() can now unconditionally call pagetable_dtor() since it is the same for all levels. * Patch 6 just uses pagetable_dtor() instead of introducing pagetable_pgd_dtor(). * Added Dave Hansen's Acked-by to all patches. - Kevin [1] https://lore.kernel.org/linux-mm/cover.1735549103.git.zhengqi.arch@bytedance.com/ Acked-by: Qi Zheng --- Cc: Andrew Morton Cc: Catalin Marinas Cc: Dave Hansen Cc: Linus Walleij Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: "Mike Rapoport (IBM)" Cc: Ryan Roberts Cc: Thomas Gleixner Cc: Will Deacon Cc: Matthew Wilcox Cc: Qi Zheng Cc: linux-alpha@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-csky@vger.kernel.org Cc: linux-hexagon@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-m68k@lists.linux-m68k.org Cc: linux-mips@vger.kernel.org Cc: linux-openrisc@vger.kernel.org Cc: linux-parisc@vger.kernel.org Cc: linux-riscv@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: linux-snps-arc@lists.infradead.org Cc: linux-um@lists.infradead.org Cc: loongarch@lists.linux.dev Cc: x86@kernel.org --- Kevin Brodsky (6): mm: Move common part of pagetable_*_ctor to helper parisc: mm: Ensure pagetable_pmd_[cd]tor are called m68k: mm: Add calls to pagetable_pmd_[cd]tor ARM: mm: Rename PGD helpers asm-generic: pgalloc: Provide generic __pgd_{alloc,free} mm: Introduce ctor/dtor at PGD level arch/alpha/mm/init.c | 2 +- arch/arc/include/asm/pgalloc.h | 9 ++---- arch/arm/mm/pgd.c | 16 +++++----- arch/arm64/mm/pgd.c | 4 +-- arch/csky/include/asm/pgalloc.h | 2 +- arch/hexagon/include/asm/pgalloc.h | 2 +- arch/loongarch/mm/pgtable.c | 7 ++--- arch/m68k/include/asm/mcf_pgalloc.h | 3 +- arch/m68k/include/asm/motorola_pgalloc.h | 6 ++-- arch/m68k/include/asm/sun3_pgalloc.h | 2 +- arch/m68k/mm/motorola.c | 21 +++++++++---- arch/microblaze/include/asm/pgalloc.h | 7 +---- arch/mips/include/asm/pgalloc.h | 6 ---- arch/mips/mm/pgtable.c | 8 ++--- arch/nios2/mm/pgtable.c | 3 +- arch/openrisc/include/asm/pgalloc.h | 6 ++-- arch/parisc/include/asm/pgalloc.h | 39 ++++++++---------------- arch/riscv/include/asm/pgalloc.h | 3 +- arch/s390/include/asm/pgalloc.h | 9 +++++- arch/um/kernel/mem.c | 7 ++--- arch/x86/mm/pgtable.c | 24 +++++++-------- arch/xtensa/include/asm/pgalloc.h | 2 +- include/asm-generic/pgalloc.h | 28 ++++++++++++++++- include/linux/mm.h | 31 ++++++++++--------- 24 files changed, 126 insertions(+), 121 deletions(-) base-commit: e2ce19225db5818f5dc22864cd225f8c425c3775