From patchwork Tue Jul 25 04:20:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13325754 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A72C2C04A6A for ; Tue, 25 Jul 2023 04:21:44 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.569354.889790 (Exim 4.92) (envelope-from ) id 1qO9Xr-000246-3E; Tue, 25 Jul 2023 04:21:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 569354.889790; Tue, 25 Jul 2023 04:21:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qO9Xr-00023z-0R; Tue, 25 Jul 2023 04:21:11 +0000 Received: by outflank-mailman (input) for mailman id 569354; Tue, 25 Jul 2023 04:21:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qO9Xq-00023t-Ig for xen-devel@lists.xenproject.org; Tue, 25 Jul 2023 04:21:10 +0000 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [2607:f8b0:4864:20::b35]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ad09e06a-2aa2-11ee-8613-37d641c3527e; Tue, 25 Jul 2023 06:21:07 +0200 (CEST) Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-d075a831636so3447885276.3 for ; Mon, 24 Jul 2023 21:21:07 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id h9-20020a25b189000000b00d0db687ef48sm1175540ybj.61.2023.07.24.21.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 21:21:05 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ad09e06a-2aa2-11ee-8613-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690258866; x=1690863666; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TyJK1FcnJgXFfZtNrnEiwbnRrWFFZ4hxtDemQIw/+70=; b=IWbM/8TKnsrsFnwfAtrtbT7DO2Dq3vbt1JDGjncQR1/QHrfo4QUSkIiEQN1x/WCeen Wq+1xfZOSXiXa3ftlSpFueFEFpvRBK3/RSrU5gjulTAyP6CHn+1+IFvHFglXW6v8keEi 8OQyuFtLfuzytADBe5cFOUdQJ/Hdq1bfJlON7Nb+Mx5/ezSX5vpuq992erh0MteP8eY0 ca2RegvmV6aTmEkiWQSzVkeiWkjDFWU6BxECXoDX15tgD4oeetn4XjwJQHkKr/UZi4jn M2rzWVhqQ0uUKv1+kbt9dezvn9EL8NwkaBEBxeHbR53ElScFeaGw8CT+ZDStPX5ya8Y8 SH2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690258866; x=1690863666; 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=TyJK1FcnJgXFfZtNrnEiwbnRrWFFZ4hxtDemQIw/+70=; b=a4fD/mQ9snEaGRpZfI67Ypx+2QTCfWKt+awDQsc2PXT46IOAhy4SE5QEf7Ic5VEE8c rJH48ys4lsEgJwnMju+V5ctbp+nqTZ8w5hsJepiMnxsvbaY+97y5veC+zeX4Td3z+sK2 501XPKjY1lsVJkaZ/F6OLYkhAuEO+VEob+fof7Q/9cRU3j4UDA/pG/G42hAvgWKz1QJ6 5fBx7IqMX94LLlHvsSyiLDtotxLWszCut4pp4enAmaf+WEmcygJsDHRQphv9byx8+Aad ZWumfaLhiKbj4zFRB0z9uy6+6g0G0SVqySfI4G8g7asd/uXPRdYPdJkoKeI6UrY0ZA9l TJsA== X-Gm-Message-State: ABy/qLaXeqbRj2ocozqmqDk6evXB9jTQpuqPOCoSchImISII9FkIB7/Y vNBHTPCon6kiBp2+G2odlgU= X-Google-Smtp-Source: APBJJlGpggWKl9mhx1f6cNzYJrVg2oqym/Xg0n0t+vhY+yg/UIrQUebANCL8UUu/vWaCrzFFriLNMw== X-Received: by 2002:a25:844f:0:b0:cf0:b977:2794 with SMTP id r15-20020a25844f000000b00cf0b9772794mr10487441ybm.30.1690258866444; Mon, 24 Jul 2023 21:21:06 -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 v7 00/31] Split ptdesc from struct page Date: Mon, 24 Jul 2023 21:20:20 -0700 Message-Id: <20230725042051.36691-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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. 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 | 56 +++---- 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, 585 insertions(+), 384 deletions(-)