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: 1775566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=c3PTBrUZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=eztCo5uQ; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q9Ctp3X04z1ydX for ; Tue, 2 May 2023 05:28:50 +1000 (AEST) 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KzFu+hrQbdBRr23Hi9FHLu0eYtvD2CHvY7hUy+G/D0s=; b=c3PTBrUZ3U7vTg asHiGvcqjfk22esuPB2966R9btYx/zK2dm0LSdWMRvJDk5jvOq5u9j865v+AE4fHJdGyMlUE5Xlwk N2gNglC4Bj2wQUEa16RzaOdqcIkv2qzbeujwZRl/jT58MJbdcSv53W7eDNSHC71tfUnfTddE0kHNQ C54TuLAqR78R4u2+D3kpIuxDBqL85miIK0MQPE2p5fpvAmfqpYR+UlK6Uz0B7nQ/sLGmFxaFY0riU JiKuSadWtbg9p40HOQZPxnkl5mf2usl/6xfEY3O74ASRERBHJNpY5W9OBhcNap/G1lZHM7dnFrmAP xFdK8N7aMhcPjHjraaGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ptZCV-00Gh6y-3B; Mon, 01 May 2023 19:28:43 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ptZCP-00Gh0a-0S; Mon, 01 May 2023 19:28:38 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-63b7b54642cso2058773b3a.0; Mon, 01 May 2023 12:28:34 -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=E/Zbj/sTxfXnW2MYh2vuI4ymPehjZ9n10vRDB5mOoukORyVr61SltCRD5xdd8xsKF5 PTRCibu4h3qkObsLan47eUN3xCIXBdfGYtehgAUCF18rvdqIhOwflSOlFHVyx4ZUmy/8 oWsL+GTgxcq84yFEwWdmeYv+OfLPeHb5RxWFJE8w8avB1TPYjc7bTivQNEu1p0ydfghA +Ku9Mqa253fJ2HATCoQWN1s1+9Lb+A59B6zfpgh5pKeTOyN+yTgVdRXAFEuXDbXbVIlX 0q598DIngTLBSm5U6dgzOeE395QjH77xZXkj7FyuI8JqR3Xlx68ko7datIxoGK/de7Cc oVFQ== X-Gm-Message-State: AC+VfDyyRTUJam9Udy7fQJV2s34fYXAWOmWhLkn+o73ZEmJQwB3SouFH OSzGxiMT8/BS2L3BNJh7h00= 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230501_122837_179413_5DE93520 X-CRM114-Status: GOOD ( 12.67 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:430 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [vishal.moola[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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(-)