From patchwork Tue Jul 30 06:46:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13746738 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 D9320C3DA49 for ; Tue, 30 Jul 2024 06:42:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 114126B007B; Tue, 30 Jul 2024 02:42:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C50A6B0083; Tue, 30 Jul 2024 02:42:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA6E46B0089; Tue, 30 Jul 2024 02:42:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CA70C6B007B for ; Tue, 30 Jul 2024 02:42:54 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 30E0780126 for ; Tue, 30 Jul 2024 06:42:54 +0000 (UTC) X-FDA: 82395476268.06.A5C7DEB Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id EE6904001F for ; Tue, 30 Jul 2024 06:42:51 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=odNyHSwO; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722321730; 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=D3W5QwLls0NnkmCCAXbf/t4g6hd/b5Axs7tNiw2YRHI=; b=qGN5LqIieClACq3628nxWnsS8bTOtPFVsUJr37LXQV19tX1BlqHeKP79mX3GAaZR/x8fE7 jrACBIwj6hLUJmE36HW8+Lcs/7kWPI2U1atXIMLTZz8CldZreLJNra5l6LqoC/sAAr+K/m veXAdqeRgNhGxdxqpQf+XynGHDFmeSQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=odNyHSwO; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722321730; a=rsa-sha256; cv=none; b=hqVa0mNayLDC7iRcusljOwyMAzAQW4uqWl4bqyMhkf3KptI9u7R3gAnb2iNd7VZEfFaMYD zRhQ3dr2kVuybIjwYJXnUyYEePMMK82A6Ltb9DqOxhqqeS/SSmyEhcB/QfcY6Hgm1Dow9t A//2hmyE5jmtOofEfZ+fnoPdLU23MdI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 42FDACE0B2F; Tue, 30 Jul 2024 06:42:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B562C32782; Tue, 30 Jul 2024 06:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722321766; bh=9fMo0SqZ7mOf+MpuDKzR6wBE4n9v1usaMOUOV+GRiz8=; h=From:To:Cc:Subject:Date:From; b=odNyHSwOlBtV2oqVtExlin1GDO7kYlIOx8pVUXrIJUKZbGYwA4WqDas0/GxrcEr55 U96WNS8VFoK93eKlrMoYeKy3Hx5hYk7u0MHfPCvnoc4pMqeCyLihL2sOgCRB2BK0LQ L8992A0T1NOO7inaUSioa2w4g0sAStq/hkXExqTSsAXodpT6mGb0xRWKuDd+nH2N+A BTsDqxMoTTjSETReBcCKjEeWWC7pCscYpqZJszwilu2vcMmxr/pCQlNwRRubPXHBaB JADt14YJLrGWRmg/Gsmy3mjRBjVlp6DBpI92v1G7zStat5RwD14Iv/xZapDPo4c7xq lwWpWj2GOPung== From: alexs@kernel.org To: Will Deacon , "Aneesh Kumar K . V" , Nick Piggin , Peter Zijlstra , Russell King , Catalin Marinas , Brian Cain , WANG Xuerui , Geert Uytterhoeven , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Naveen N Rao , Paul Walmsley , Albert Ou , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Andy Lutomirski , Bibo Mao , Baolin Wang , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Qi Zheng , Vishal Moola , "Aneesh Kumar K . V" , Kemeng Shi , Lance Yang , Peter Xu , Barry Song , linux-s390@vger.kernel.org Cc: Guo Ren , Christophe Leroy , Palmer Dabbelt , Mike Rapoport , Oscar Salvador , Alexandre Ghiti , Jisheng Zhang , Samuel Holland , Anup Patel , Josh Poimboeuf , Breno Leitao , Alexander Gordeev , Gerald Schaefer , Hugh Dickins , David Hildenbrand , Ryan Roberts , Matthew Wilcox , Alex Shi Subject: [RFC PATCH 00/18] use struct ptdesc to replace pgtable_t Date: Tue, 30 Jul 2024 14:46:54 +0800 Message-ID: <20240730064712.3714387-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Stat-Signature: c39z3a8ecap4tj7bi5xkxrykdjhh4auz X-Rspam-User: X-Rspamd-Queue-Id: EE6904001F X-Rspamd-Server: rspam02 X-HE-Tag: 1722321771-453930 X-HE-Meta: U2FsdGVkX18BPUFVNRvTC2F62cGtyCDZhHuZEIWTOpfWVB9c/Jwld3ecy6+sm/Ktnc05Kb4k1NgfeNqU6OAOGJQ9D24ULrc8JKQsVztRnbBSmCd48LDtrLGoNyoWQxOTWfxRwv2gfbJSvrOaVNmz3CAzVg4DaTG/x+E02qTIT9tCepplG9ffB8u7rep6UA1YPv7l1U4e86RgtbpC4rOUu5I9reznVg8C2GXv8DMjsxquRN8mgzqSJIKxZ9zBtLzR7bdbmJ52rm9b+p9APlmJK8jZa3GcIxiGZgQX/NZWo/u0bsvQ+9DeHIWjR124EKxtxhvcxTUXGCGmcwJlmk8Qw7YcBg0VvMk1VBgfQPmHVnBMxFu/y4PrYhZGIMERx3OnWEaziOctPEKKIz0LHLboqYWoTXTGuj0fnaAlokvoEzNWSRJzQAS8XUukEUi8WxsL7joGS0wijVKOBkoSz65UMmV07VxvrZXFZUCFUZZEgXlXDMe9xfrJPZ9cCe/1DBp30fOXAqe8IjLUqPDmROQ4fJvBttlGYETOLe3xRlms5X/xB6EYjMnU6bvLaVwU01+1prnzJBKsbnXgYp26omq+23wvwM/u1JyypQXtq5QZZy6jqy5NeFMXyaS/wbuxIELnpl5ujhuEECIsmXC+Q/7UJ6yn50d/hRXQBYyYcyxbGKt40KF5I6PEllKj5U18VAO9iHJz3433y6RepY887e+xvTCVJ6EHOG5u6qtKpB59hC7ymuYlxL9iCjY3Z4qmrlNQ22CYO9Ee21KB2XQR2A2pLoG9pwJRNnaME/EZ1rY6/lvw5JvoVvIDtyWtXeNfUyjS6QHzGHHqNmQF81ufGGvGgf9GQ1mPF/3KDK0/EWNZ5UElYrl4PYwGY+t9WGcjLxUkyqCb1UOfRwJ7Z1Dos5SOVjqvP4+sKq7gwJ/8PqU3NahTjEwYTmO/DH8mF/bD1XHCb2SJ8TjjCZTPjMUPaby z7ZmCEe3 xY2o2gc6b5yy7NfXEPA6eDSi7RsSJiKre3UzuNoFSc5J2V4Q8UB71ejpxwsXAazXQayb80KR028K783F35v2sd+ul59uGKb1GEWf+tg3TxsuPaWOJFkoDDh07kAnWFmX1dO7Iy3N1hxlivijS1j8GehmfkpLFuXj5Hbay7+LelzhZRQjgeggvFnsqV9ml38Lwc9YTjjTMeKLrZNIxsxpzT6dvQ41VKHUAfazucPD8xw44E2c9qvtOQAljxEJ2Vi1eazm53xvzIwQPpQQo6S4mjxcsLFSRfHpW4GE81xvAw1MrpLgfbmE0tvRqS9L7Ga0XQC8HQzlcZzK2BEIlaIzH9f9wc/7GxrU8SNhi9cswMRtIdk1EgDsBwtMKONXzhPwHclDqj38HOiMyuLk= 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: List-Subscribe: List-Unsubscribe: From: Alex Shi We have struct ptdesc for page table descriptor a year ago, but it has no much usages in kernel, while pgtable_t is used widely. The pgtable_t is typedefed as 'pte_t *' in sparc, s390, powerpc and m68k except SUN3, others archs are all same as 'struct page *'. These blocks the conception and code update for page table descriptor to struct ptdesc. So, the simple idea to push the ptdesc conception forward is to update all pgtable_t by ptdesc or pte_t pointer. But this needs widely knowledges for most all of different archs. Common code change is easy for include/ and mm/ directory, but it's hard in all archs. Thanks for intel LKP framework, I fixed most all of build issues except a bug on powerpc which reports a "struct ptdesc *" incompatible with struct ptdesc *' pointer issue... Another trouble is pmd_pgtable() conversion in the last patch. Maybe some of arch need define theirself own pmd_ptdesc()? This patchset is immature, even except above 2 issues, I just tested virutal machine booting and kselftest mm on x86 and arm64. Anyway any input are appreciated! Thanks Alex Alex Shi (18): mm/pgtable: use ptdesc in pte_free_now/pte_free_defer mm/pgtable: convert ptdesc.pmd_huge_pte to ptdesc pointer fs/dax: use ptdesc in dax_pmd_load_hole mm/thp: use ptdesc pointer in __do_huge_pmd_anonymous_page mm/thp: use ptdesc in do_huge_pmd_anonymous_page mm/thp: convert insert_pfn_pmd and its caller to use ptdesc mm/thp: use ptdesc in copy_huge_pmd mm/memory: use ptdesc in __pte_alloc mm/pgtable: fully use ptdesc in pte_alloc_one series functions mm/pgtable: pass ptdesc to pte_free() mm/pgtable: introduce ptdesc_pfn and use ptdesc in free_pte_range() mm/thp: pass ptdesc to set_huge_zero_folio function mm/pgtable: return ptdesc pointer in pgtable_trans_huge_withdraw mm/pgtable: use ptdesc in pgtable_trans_huge_deposit mm/pgtable: pass ptdesc to pmd_populate mm/pgtable: pass ptdesc to pmd_install mm: convert vmf.prealloc_pte to struct ptdesc pointer mm/pgtable: pass ptdesc in pte_free_defer arch/alpha/include/asm/pgalloc.h | 4 +- arch/arc/include/asm/pgalloc.h | 4 +- arch/arm/include/asm/pgalloc.h | 13 +-- arch/arm/include/asm/tlb.h | 4 +- arch/arm/mm/pgd.c | 2 +- arch/arm64/include/asm/pgalloc.h | 4 +- arch/arm64/include/asm/tlb.h | 4 +- arch/csky/include/asm/pgalloc.h | 4 +- arch/hexagon/include/asm/pgalloc.h | 8 +- arch/loongarch/include/asm/pgalloc.h | 8 +- arch/m68k/include/asm/motorola_pgalloc.h | 12 +- arch/m68k/include/asm/sun3_pgalloc.h | 4 +- arch/microblaze/include/asm/pgalloc.h | 2 +- arch/mips/include/asm/pgalloc.h | 4 +- arch/nios2/include/asm/pgalloc.h | 4 +- arch/openrisc/include/asm/pgalloc.h | 8 +- arch/parisc/include/asm/pgalloc.h | 2 +- arch/powerpc/include/asm/book3s/32/pgalloc.h | 4 +- arch/powerpc/include/asm/book3s/64/hash-4k.h | 4 +- arch/powerpc/include/asm/book3s/64/hash-64k.h | 4 +- arch/powerpc/include/asm/book3s/64/pgalloc.h | 4 +- arch/powerpc/include/asm/book3s/64/pgtable.h | 8 +- arch/powerpc/include/asm/book3s/64/radix.h | 4 +- arch/powerpc/include/asm/pgalloc.h | 8 +- arch/powerpc/mm/book3s64/hash_pgtable.c | 10 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 10 +- arch/riscv/include/asm/pgalloc.h | 8 +- arch/s390/include/asm/pgalloc.h | 4 +- arch/s390/include/asm/pgtable.h | 4 +- arch/s390/mm/pgalloc.c | 2 +- arch/s390/mm/pgtable.c | 14 +-- arch/sh/include/asm/pgalloc.h | 4 +- arch/sparc/include/asm/pgalloc_32.h | 6 +- arch/sparc/include/asm/pgalloc_64.h | 2 +- arch/sparc/include/asm/pgtable_64.h | 4 +- arch/sparc/mm/init_64.c | 2 +- arch/sparc/mm/srmmu.c | 6 +- arch/sparc/mm/tlb.c | 14 +-- arch/x86/include/asm/pgalloc.h | 10 +- arch/x86/mm/pgtable.c | 8 +- arch/xtensa/include/asm/pgalloc.h | 12 +- fs/dax.c | 14 +-- include/asm-generic/pgalloc.h | 10 +- include/linux/mm.h | 16 ++- include/linux/mm_types.h | 4 +- include/linux/pgtable.h | 6 +- mm/debug_vm_pgtable.c | 6 +- mm/huge_memory.c | 103 +++++++++--------- mm/internal.h | 2 +- mm/khugepaged.c | 14 +-- mm/memory.c | 15 +-- mm/mremap.c | 2 +- mm/pgtable-generic.c | 37 +++---- 53 files changed, 240 insertions(+), 236 deletions(-)