From patchwork Mon Aug 7 23:04:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13345284 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 30F4DC001DE for ; Mon, 7 Aug 2023 23:05:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2230D8E0001; Mon, 7 Aug 2023 19:05:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D3D38D0001; Mon, 7 Aug 2023 19:05:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09B878E0001; Mon, 7 Aug 2023 19:05:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EF57C8D0001 for ; Mon, 7 Aug 2023 19:05:21 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B20C4B2267 for ; Mon, 7 Aug 2023 23:05:21 +0000 (UTC) X-FDA: 81098841642.04.AA340FD Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by imf02.hostedemail.com (Postfix) with ESMTP id 60DE380006 for ; Mon, 7 Aug 2023 23:05:19 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kkOLGueM; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.175 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=1691449519; 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=BgGe0Il0C7dlkrriaFCN0meYItalZZUDKy884yxXSME=; b=Fw50kg5rZQPOSkFDcAyTmtdhLCPrgOdtOwEic9iVAScrdLRBrtpbrHF6YAarZ3FX05UByd cdQVo/TO23UK7yLLVB52Y+1n2YpHIzRVmc2JpoHo11mrvlVQM5e0FhkwhvTicOGjf3AiGV SOvTv8Hg6vnMZpSGW9k5YbZVe1A1M8o= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=kkOLGueM; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.167.175 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691449519; a=rsa-sha256; cv=none; b=T1VHUIcYeDEBDoLP7G24uRHqH5TZWIta9D/dIEDnSjLYQrboSCophICLLOww3JA27TmDDF Xhzq9t0EL/J41XseWDrT0YkjLFIQWIIVDbvlO0RpZpRmV0vdJyXB9LItVqUEFaBhmcR3Pu Jp5RxFJ8cMSnDmGDpuO2nQlbIJBJ+AE= Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3a74d759be4so3750850b6e.2 for ; Mon, 07 Aug 2023 16:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691449518; x=1692054318; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BgGe0Il0C7dlkrriaFCN0meYItalZZUDKy884yxXSME=; b=kkOLGueMrzxHvvdT5O8JIC8nC89W6/6UqoBnx7sB0VLAWpoO0/QHm5tLARAi96zyvU EAiiieHkpJTC9s5qvXPj39j6R2OQuCyqiEOwPTIq50/LHvV7fjReDxpsCX5Ya8M70FRF Bv+KZVFj7Mytss2brk2EH7Z9tHAP9yxEVCzntaEZzdSmQz9vPa1mUTDeJlBFV79lhO4m YdB4aoA79x9pkxJ/XBt7ZG1CR58HGrAi0v/zgewNhzm8aq6TJsefwLnAAAHjOqkPytFk EiZRzEbAgPBMpklpMOtlFM2muNSx1qBww2MBrDwGN8Akv7FqeHgJ4R5d3wn1SAH6io9W CEdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691449518; x=1692054318; 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=BgGe0Il0C7dlkrriaFCN0meYItalZZUDKy884yxXSME=; b=LDYWjwf/CFmo+SRJpH8IMUjEJf1OqkGpw2HEX8s8FGW2+dkJBUtkN/ciZeBBKXL/33 80tM8WgnwBxeucWn2c07kREkKVrU/6rBc03FBp8Vl4HgRWQUrIKaVAzhybZVX1tc53+T XlDxuv06Vv2u89b3oMsKQQ4R2GG5ZkVmH9m3L8ULt4947AOOZOwPtXE4sbwYscP0n6g4 Fvvw/7cS2WnIivRebsm8tniUtVgPLuiuYk+jDbxUcLwEtqAOxAgxmb0/z/+wBdc4biGB 5Aw0AYh5cL4aWjnLtQT7u0m0mRAjqrVyccgLeFG++pE7/pweNs/zcPL3eo/8PRBywkjs yKIQ== X-Gm-Message-State: AOJu0Yxlmbo62B6UE055Z3xD7HfK82xzPd7VDGWyPZoafaHrp0SiCGWX x0PkIQ/niUwgS5+IS1aIiTA= X-Google-Smtp-Source: AGHT+IHI1CCxgU6LoWPuJYJEyHtYip1YJBCUFIlnO8SlV49xsFZp+VSY6a51skH1ZTqS0RRAJqit6Q== X-Received: by 2002:aca:d12:0:b0:3a1:f237:ec62 with SMTP id 18-20020aca0d12000000b003a1f237ec62mr10346742oin.48.1691449518360; Mon, 07 Aug 2023 16:05:18 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id d190-20020a25cdc7000000b00d3596aca5bcsm2545203ybf.34.2023.08.07.16.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 16:05:17 -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 v9 00/31] Split ptdesc from struct page Date: Mon, 7 Aug 2023 16:04:42 -0700 Message-Id: <20230807230513.102486-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: nxgpzjfx5wgbixxatnguk39ckwzjtsw5 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 60DE380006 X-HE-Tag: 1691449519-285827 X-HE-Meta: U2FsdGVkX1+qZ/7Vmgagf7WfoImhGJgMgrqe1Yk0l5AwCXXuuZaV/fsmamn5zUURJjeO1NMrwiAGTjScFk/oLT3C1huyf2byWqN4EKJHMbzouddqyhz2/M3Rh8YBP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psGqgcZT6/iLor6QMbQXVe2JpN019ftKNQ+x77GEXvhTyZAAW3Jku0l/VLMg+4WYmhlagG9lty8J6EyRnCG30RxgOsiBQy0ynxHN4KUOtwXWUqqaz9zvSHMzjllR6k4B8VoC8i+ab9mc/puXZBAXUj7Xaj44f4AWWjT5NwJxIRUbkLlQNBzyL4psnBPRXdnU1FMBsmdvAZjUj+MmfPXavtkkiBox4/oGUX9rflsilv13kfJnz9hDv0lmwAgU2CFwXpFRD4AgYx8NgLme2lOnKq9eXGte8ad6cSeGuD+YO8YGoKD63dTDRD6PbTE5YbXhMfNAFeN 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 applies cleanly onto the current unstable after dropping v8 of this series. v9: Fix build errors for NOMMU configs - trying to define ptdesc before spinlock_t and struct page were defined. Moved definition of struct ptdesc to include/linux/mm_types.h instead include/linux/pgtable.h 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 | 97 ++++++++--- include/linux/page-flags.h | 30 +++- mm/memory.c | 8 +- 37 files changed, 585 insertions(+), 385 deletions(-)