From patchwork Mon Jul 31 17:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335110 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 AB236C001DC for ; Mon, 31 Jul 2023 17:04:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0131F6B0174; Mon, 31 Jul 2023 13:04:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE1166B0175; Mon, 31 Jul 2023 13:04:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D310B6B0176; Mon, 31 Jul 2023 13:04:04 -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 C05456B0174 for ; Mon, 31 Jul 2023 13:04:04 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7A2B7120BA9 for ; Mon, 31 Jul 2023 17:04:04 +0000 (UTC) X-FDA: 81072529608.21.3F6782D Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by imf07.hostedemail.com (Postfix) with ESMTP id ECF2B4008A for ; Mon, 31 Jul 2023 17:03:38 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FItEz4g6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690823019; 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=ryTLkHDnIGhrwoqJrwF4w+CKAk7Or3iQY3ycYEnzI1s=; b=fyNFBcxPfQOkJxG3+9csLUqVDXQj9JzCj66pjECF12UgF9BV5kRdmS0BGzx9SapnPSU9dJ 1qcxMFNfDBtcrYpao0DeYLYagGU8cPPOIbP8g6dRynhM1wP98E/UBi81xQwMej+XjclMwT oV5nBJhidPBn9CqD2mau+9t7+Rugux0= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=FItEz4g6; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823019; a=rsa-sha256; cv=none; b=6HgjOXGSiHnmyL/H48FARPvWThuiiGtmp3TD+3QoXdokYR9QnqpEPOR75r/anOyjdRPjzM sXyZYzUeWAeFegnUuTzix12XZMF47T9+8Guk5D7KGRl52BDxCNmp5o5cs1KQyGJDJy9Upo svwRZ1Rj5YP1ZnDnnJhpHokjAh+gH8E= Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-d167393b95aso8381217276.0 for ; Mon, 31 Jul 2023 10:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823018; x=1691427818; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ryTLkHDnIGhrwoqJrwF4w+CKAk7Or3iQY3ycYEnzI1s=; b=FItEz4g6fK8MUe9in0y5zvq54vvv6vRus4MvaXB5z0kFF5Wd4GxyLG45TIMFtswPBZ o5hWJRASIfXbLHcyuajDu2shNzEC3fqz1lq+2UGzWjNRBxNrOGPJc7+FeZHb270T76uP DVP8E3UCWoa73Cj1cemt4q3bHNezkBDrcXpoGHgWYyrjCA03wHK6cuEEIp3IlP9F3vH7 B0WVEfhX/KMZdz2qP55P02W/l5cO6EeJ2/dVRRpuTUrHoGO/LbskVtPeDS55S32mzgKs 4t8PJ/VzqvancbDUNXdKozgYa+ZBjOr6Csg18HLyiAYJhBTxnGsnAH6C4GyD3p+69e1s v6hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823018; x=1691427818; 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=ryTLkHDnIGhrwoqJrwF4w+CKAk7Or3iQY3ycYEnzI1s=; b=WtQwf+ERLy7t3Kl9y9kD9og9P/SuEBxj6LsIFfETMr+YT2kwpcWN0CKuWpEzbXiMUZ luFJihoaUxzdwgcuCT5XXiZGDqgYpIzBdxGXWFIUyt+dly/0Z6ACvbNhtR7/D3SE26Fh ztJRQ7cpZlEFT5e5K5DFLM4ELgs8CA3SGwQUXrX7rGKals0GWRaF2JuhelSmOxjR/mVV myu7KKMhP7X/A3DajL98BizfdVk/toBIApchIZpW4uSUq+JSIwyqnmMl4uTdtPWgJn6n xThHWqjJ7Y7zF5y3P4y+peBoMjJj7VHTx+CgLr9HFjXyS+Dbd9tdTjEH16VrfMAFNQZE fXlQ== X-Gm-Message-State: ABy/qLbgyY9tPtaB6dJQrC3PXGKo/ETFcQXEeXiWeBrut22SmMrOIhd7 mSa0STio1X1naOPjmxAWQnA= X-Google-Smtp-Source: APBJJlF+dh42RzdYn0EXh+W1YGBDbhVTCkZUXnYcADIxILBW8gkVGvh5Vx2rhlYPGGopBifzCd0Ntg== X-Received: by 2002:a25:d1d0:0:b0:d1c:5a9a:48d2 with SMTP id i199-20020a25d1d0000000b00d1c5a9a48d2mr11161535ybg.19.1690823017725; Mon, 31 Jul 2023 10:03:37 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:03:37 -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, Hugh Dickins , "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 , Christophe Leroy Subject: [PATCH mm-unstable v8 00/31] Split ptdesc from struct page Date: Mon, 31 Jul 2023 10:03:01 -0700 Message-Id: <20230731170332.69404-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: ECF2B4008A X-Stat-Signature: ac7wg53yruhw4hw73zp8y4jskronri54 X-Rspam-User: X-HE-Tag: 1690823018-606620 X-HE-Meta: U2FsdGVkX1+77aSFHoTtIgutQo3CoB5fzUMFW/TsSGCytRcD+LvUfNH7YZM8ZbzR/hZuOpKJJPkmhu4vs3Jx5TEO3knbqEnN3rdULwmZivTkRuLcZ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VUzCXc/qs32EqUFapXFwh1F4byw33gcjcMOovYRfSPe16gV6l7pJxA66/ZO/m0XXa+HKxci0hJc2SJFBC/IPDtb8GNlAiHlFgeJCOdoBStJJ23u6g4qWszp6B2k7nqm9HeOY+D2/nOzjYK9XeYsCvai5tJoNiXjSX93lv9hJCcnibtdenrHW8JAWdd6B0TxsPMOLD5uwpuQ1Ikwnzfs9kw94tvFKgpV2C6DLyeMKnh6cnqh1lhGpf6BAMeBwO41bWhCuAsVhl5S3L5PvjCZeti4ycv/U5VJBBneWl8MQDso2IkJspxcircz+OG 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 mm-unstable. v8: Fix some compiler issues v7: Drop s390 gmap ptdesc conversions - gmap is unecessary complication that can be dealt with later Be more thorough with ptdesc struct sanity checks and comments Rebase onto mm-unstable Vishal Moola (Oracle) (31): mm: Add PAGE_TYPE_OP folio functions pgtable: Create struct ptdesc mm: add utility functions for ptdesc mm: Convert pmd_pgtable_page() callers to use 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 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 | 7 +- 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 | 47 +++--- arch/m68k/include/asm/sun3_pgalloc.h | 8 +- arch/m68k/mm/motorola.c | 4 +- arch/mips/include/asm/pgalloc.h | 32 ++-- arch/mips/mm/pgtable.c | 8 +- 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 | 58 +++---- 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/pgalloc.c | 128 +++++++-------- 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 | 47 +++--- arch/x86/xen/mmu_pv.c | 2 +- include/asm-generic/pgalloc.h | 88 +++++----- include/asm-generic/tlb.h | 11 ++ include/linux/mm.h | 151 +++++++++++++----- include/linux/mm_types.h | 18 --- include/linux/page-flags.h | 30 +++- include/linux/pgtable.h | 80 ++++++++++ mm/memory.c | 8 +- 38 files changed, 586 insertions(+), 385 deletions(-)