From patchwork Mon May 1 19:27:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227919 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 0AE90C77B7C for ; Mon, 1 May 2023 19:28:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8292B900003; Mon, 1 May 2023 15:28:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DA2D900002; Mon, 1 May 2023 15:28:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A139900003; Mon, 1 May 2023 15:28:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5E447900002 for ; Mon, 1 May 2023 15:28:37 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 276D01C6E55 for ; Mon, 1 May 2023 19:28:37 +0000 (UTC) X-FDA: 80742673074.18.3D5BAD2 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf29.hostedemail.com (Postfix) with ESMTP id 5E7AA120003 for ; Mon, 1 May 2023 19:28:35 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=eztCo5uQ; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969315; 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:dkim-signature; bh=ipls6koA+AeH8J6j2WxgUhcq4mmw5a3NH+J2RY9iS6I=; b=LdhYpnhcFk/uZnA33uN+NFpxqN/Zwmb9/h2zutno3aegbT6+7AuqJ9cTHa3k6X0zcD/j0f 7F2KrVuQVx4LWkEQxE4FPIK5ky3fX7+lndHP3XJrvqn7jbYKEfHAJcS4iWVF9lN6JPqhh0 E7T06CWPI1/to5hOyziQmCFFeVUDG7I= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=eztCo5uQ; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969315; a=rsa-sha256; cv=none; b=x5Q5w0LNzir/HSj68900tS+4m4i9HX/i3MLg4CGGfk5vYGP1gQJhKKJcCpUrsfzu1se0WN PIRT4R6IZ3KPOldf3UcyyvzA4NnO3MzpVbvrIpsZAqToIOsWx+V+LBC71W0ccE4d4d2PQw XgvAmoF3KckS/CGoWE1+sk7UId6H9PM= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1aaf21bb42bso11005065ad.2 for ; Mon, 01 May 2023 12:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969314; x=1685561314; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ipls6koA+AeH8J6j2WxgUhcq4mmw5a3NH+J2RY9iS6I=; b=eztCo5uQgzZ++c4nibUBiIDXpS2LGO24+qSzaafIbpKx+1BibUdX3vQLCCvqCM9QaK k2szVsQtO5BsNtu2gEbwQ2R1Cp8SZWTwumicPfkwsEEQtcvZx+KCA7E9E8yQbBLG/+U1 YuKydYrLelSrUvEFcJOenbExJISoaZaYCzUq7BQHSqP3uoPFqEPYIMH3FrftdGe1VnOk 18/QJSaB/qqzmIXnj9u6ae7JwxuEe1M8it5S+Q9K46yajD+0ZkqBf7KewtfRcvygNDOo LlI0LPcK+WO/JxG3p9SD85FYmZExm1luEC4PEkLlS1jz538f0/tapw7EjRytIfe2E8ce OeqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969314; x=1685561314; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ipls6koA+AeH8J6j2WxgUhcq4mmw5a3NH+J2RY9iS6I=; b=JiZFyTO8MTVRPEqAz3TIKjmfIJkhLLjJA2Ydpsq3WgN2syQjMMH0PtTaX1caArBHuf nA5dFbZ//Cmh3g1zob/7iUuVcCCR0NeW4UN9+6hrNW1MvsUUq1ZA+SAIm3rkEavfho/A 8fMb7kyGc/zGaT5hB4oV/xBycz4Ak1pdixJfJMtfszbACl9YQ/vtEHr4iyjKc3RurT2D PDb8598MaSV8a8dETeN4e3EijISJFjLDLcC/HnrhKtwLMEG5ueocS5BvrmqBYIdj+rYs V4zkPtYDApVUctY1UGMrfsnr3ylPRTvgxh9vdc9ylv9az+FkFD6+fGLxTb2f0oaDL/DV W3lQ== X-Gm-Message-State: AC+VfDzewgji+k08jDn+zIhYTLyCMxXPxRS7KcMIEQuSHPOGAQ+31uJC Mlkgz4u26q7DZj/b75Ee3hE= X-Google-Smtp-Source: ACHHUZ4EtcVpfh2GrxC12spi0fGVMtR6JEHjWCZcT25vgipN1a5chaj6S10yX1bBKRrgSrOQ8bpQcQ== X-Received: by 2002:a17:903:2310:b0:1a6:54ce:4311 with SMTP id d16-20020a170903231000b001a654ce4311mr18428090plh.43.1682969314058; Mon, 01 May 2023 12:28:34 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:28:33 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, "Vishal Moola (Oracle)" , Catalin Marinas , Huacai Chen , Geert Uytterhoeven , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , David Hildenbrand , Claudio Imbrenda , Paul Walmsley , "David S. Miller" , Richard Weinberger , Yoshinori Sato , Dave Hansen , Arnd Bergmann Subject: [PATCH v2 00/34] Split ptdesc from struct page Date: Mon, 1 May 2023 12:27:55 -0700 Message-Id: <20230501192829.17086-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Stat-Signature: yjfdiasp3dqm3g674mcktxf7bugpp8xw X-Rspam-User: X-Rspamd-Queue-Id: 5E7AA120003 X-Rspamd-Server: rspam06 X-HE-Tag: 1682969315-841000 X-HE-Meta: U2FsdGVkX19OJuyILdNW7HcIpy7u5dwSrxkwXPKBRq3UJfGeIzL+WL/N0GgPgMrSLDY9D9sIZXeLszc6yBsLad7jrg8VkKLJDiwNPukKzlk6mn6z0beMlWxtFjYi0ASgtL8Ad2KloM0eUndv6uA9knfwJN+DfKILe4ITzHOSjj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5gshQfFTu+A8Iei0Ndq7iTs9sfehjuQVtx/uFG4l5hU9vWOKRIER6GXc+llrZjdZeHW7J9gW8LneXoS2ErTovAgslXDy2FCYe+0iEL0GSAUPrQKvKF7v/j2xtCe+/sONIhS/7IxT+wqjLbP2Fb/50lWtvaB/7LSQAfpiXlug7HkBCNFLDwfed6q7l289nMcbPgVylYAY7CLXfDBu0mOD2fjqY2bq86h99Y4FjJL/PN/ 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: The MM subsystem is trying to shrink struct page. This patchset introduces a memory descriptor for page table tracking - struct ptdesc. This patchset introduces ptdesc, splits ptdesc from struct page, and converts many callers of page table constructor/destructors to use ptdescs. Ptdesc is a foundation to further standardize page tables, and eventually allow for dynamic allocation of page tables independent of struct page. However, the use of pages for page table tracking is quite deeply ingrained and varied across archictectures, so there is still a lot of work to be done before that can happen. This is rebased on next-20230428. v2: Fix a lot of compiler warning/errors Moved definition of ptdesc to outside CONFIG_MMU Revert commit 7e25de77bc5ea which had gmap use pmd_pgtable_page() Allow functions to preserve const-ness where applicable Define folio equivalents for PAGE_TYPE_OPS page functions Vishal Moola (Oracle) (34): mm: Add PAGE_TYPE_OP folio functions s390: Use _pt_s390_gaddr for gmap address tracking s390: Use pt_frag_refcount for pagetables pgtable: Create struct ptdesc mm: add utility functions for ptdesc mm: Convert pmd_pgtable_page() to pmd_ptdesc() mm: Convert ptlock_alloc() to use ptdescs mm: Convert ptlock_ptr() to use ptdescs mm: Convert pmd_ptlock_init() to use ptdescs mm: Convert ptlock_init() to use ptdescs mm: Convert pmd_ptlock_free() to use ptdescs mm: Convert ptlock_free() to use ptdescs mm: Create ptdesc equivalents for pgtable_{pte,pmd}_page_{ctor,dtor} powerpc: Convert various functions to use ptdescs x86: Convert various functions to use ptdescs s390: Convert various gmap functions to use ptdescs s390: Convert various pgalloc functions to use ptdescs mm: Remove page table members from struct page pgalloc: Convert various functions to use ptdescs arm: Convert various functions to use ptdescs arm64: Convert various functions to use ptdescs csky: Convert __pte_free_tlb() to use ptdescs hexagon: Convert __pte_free_tlb() to use ptdescs loongarch: Convert various functions to use ptdescs m68k: Convert various functions to use ptdescs mips: Convert various functions to use ptdescs nios2: Convert __pte_free_tlb() to use ptdescs openrisc: Convert __pte_free_tlb() to use ptdescs riscv: Convert alloc_{pmd, pte}_late() to use ptdescs sh: Convert pte_free_tlb() to use ptdescs sparc64: Convert various functions to use ptdescs sparc: Convert pgtable_pte_page_{ctor, dtor}() to ptdesc equivalents um: Convert {pmd, pte}_free_tlb() to use ptdescs mm: Remove pgtable_{pmd, pte}_page_{ctor, dtor}() wrappers Documentation/mm/split_page_table_lock.rst | 12 +- .../zh_CN/mm/split_page_table_lock.rst | 14 +- arch/arm/include/asm/tlb.h | 12 +- arch/arm/mm/mmu.c | 6 +- arch/arm64/include/asm/tlb.h | 14 +- arch/arm64/mm/mmu.c | 7 +- arch/csky/include/asm/pgalloc.h | 4 +- arch/hexagon/include/asm/pgalloc.h | 8 +- arch/loongarch/include/asm/pgalloc.h | 27 ++- arch/loongarch/mm/pgtable.c | 7 +- arch/m68k/include/asm/mcf_pgalloc.h | 41 ++-- arch/m68k/include/asm/sun3_pgalloc.h | 8 +- arch/m68k/mm/motorola.c | 4 +- arch/mips/include/asm/pgalloc.h | 31 +-- arch/mips/mm/pgtable.c | 7 +- arch/nios2/include/asm/pgalloc.h | 8 +- arch/openrisc/include/asm/pgalloc.h | 8 +- arch/powerpc/mm/book3s64/mmu_context.c | 10 +- arch/powerpc/mm/book3s64/pgtable.c | 32 +-- arch/powerpc/mm/pgtable-frag.c | 46 ++-- arch/riscv/include/asm/pgalloc.h | 8 +- arch/riscv/mm/init.c | 16 +- arch/s390/include/asm/pgalloc.h | 4 +- arch/s390/include/asm/tlb.h | 4 +- arch/s390/mm/gmap.c | 222 +++++++++++------- arch/s390/mm/pgalloc.c | 126 +++++----- arch/sh/include/asm/pgalloc.h | 9 +- arch/sparc/mm/init_64.c | 17 +- arch/sparc/mm/srmmu.c | 5 +- arch/um/include/asm/pgalloc.h | 18 +- arch/x86/mm/pgtable.c | 46 ++-- arch/x86/xen/mmu_pv.c | 2 +- include/asm-generic/pgalloc.h | 62 +++-- include/asm-generic/tlb.h | 11 + include/linux/mm.h | 138 +++++++---- include/linux/mm_types.h | 14 -- include/linux/page-flags.h | 20 +- include/linux/pgtable.h | 61 +++++ mm/memory.c | 8 +- 39 files changed, 648 insertions(+), 449 deletions(-)