From patchwork Tue Jul 30 07:27:17 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: 13746823 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 C688AC3DA61 for ; Tue, 30 Jul 2024 07:23:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BC0E6B009C; Tue, 30 Jul 2024 03:23:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 545AB6B009D; Tue, 30 Jul 2024 03:23:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 398076B009E; Tue, 30 Jul 2024 03:23:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 11EAD6B009C for ; Tue, 30 Jul 2024 03:23:50 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BE17EC0145 for ; Tue, 30 Jul 2024 07:23:49 +0000 (UTC) X-FDA: 82395579378.02.3C28B48 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf04.hostedemail.com (Postfix) with ESMTP id 7E6E140005 for ; Tue, 30 Jul 2024 07:23:47 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VS2i0h4S; spf=pass (imf04.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=1722324173; 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:in-reply-to:references:references:dkim-signature; bh=tEqE0wkMYsKv4+fX7oIC7E0LE+b3qdn9nVBUuca8EIw=; b=Ik/Wpcs+V9fZmPL3adtbm8SRvysjgmiC+ShlJxTpeayu+ZrJR2QaL7TzhSb6rL4CXv2zBt y6ev961aF//Tq6N9d+jgzEy5u0d2ax/XalBL2FMOis5RGm97Nya6bzUb8qYM8SHhlLPB2F JWN7QuBeORpPsTf3OAl+ZqQmYPksu3Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722324174; a=rsa-sha256; cv=none; b=Dr2zjGKHNqN8Y8J5inPmjItO34sVCx6I6HHWk039SZMYSwmbwKSqdjSW3+VVj/aMQfRZgG akOq29lmIf1UsoM+RF02/yV2e3pS+XZKuj7KyuiyD9H5wY5y24c7h3d5om5JofptbjXdNo k+fHvBGjUyDOJnA9fSi8UWL814c3+vo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VS2i0h4S; spf=pass (imf04.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 919D4CE0EC5; Tue, 30 Jul 2024 07:23:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8986AC32782; Tue, 30 Jul 2024 07:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722324223; bh=MBumahwIovMrLM2xijUGbqbzC8eqefcbVCDPjO9VQdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VS2i0h4StkfC64c/JDyScKsNP0M1q1w3AGB7FpchDWYE3z1M10NJVKgdKsS8NCbiy d2uHvMiSRGm1FVHaBK8eFwUvEtY7QsciTEUxncVwivItvrAAyaZKX/UrzKXDsx80fB hdVzmcvfXZq0cq838KL/IIOuw5o6htAm35hjuefbFnaeXbpXlVepWunB9D2y1XoH/P DOr/E3Jc/8HLWb1qhmvVZLFWhR2A9Ugp62gjlZlG+ibYdl1NrFjQKylKux8BJ7W6+i nRKNxS68jjsmSHjYUvwPjztBhfwuSyjjuZuFnGp5UzkRLxjYlH9kVNt7n3/xt5EXtO i4Za4M6sm1W+Q== 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 , "Naveen N . Rao" , linux-fsdevel@vger.kernel.org, Andrew Morton Subject: [RFC PATCH 16/18] mm/pgtable: pass ptdesc to pmd_install Date: Tue, 30 Jul 2024 15:27:17 +0800 Message-ID: <20240730072719.3715016-6-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240730072719.3715016-1-alexs@kernel.org> References: <20240730064712.3714387-1-alexs@kernel.org> <20240730072719.3715016-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7E6E140005 X-Stat-Signature: tducqaejonb6w51tf3xwwafkjgtucx56 X-HE-Tag: 1722324227-393472 X-HE-Meta: U2FsdGVkX1/cip1UayHaYJWpMAjXdYcsvPlp4wCsFmz/kn67jwJf3p5w5+4HEN2vqZcXo5NmrQR6HaHDE9DchBKJQFfpl7mXLsImOdxES47ik9+GboBYptrKQXVcyOIJxv3JdTFH3MrAfWwXYGep9cxhkfP4hJoclcpTidPv0Hv/IZcnnkVIO2lbbIe3g4YBgvVYPX0HCovbMwgy3o8OKgyAtJ/cEThdyfbQksWlDwDYQFgT5Ak4PbxKQSE7ACA9sziu2klIF/LLC5y9iqj+wQUGpuIQY448AWocDnf7VY/ZI9GFXk7UBI9tECwblrqh+USvjaGq0TrpxAw0p4WXjG3X+pgmc+lwd3mg5W7y7TtX+iCvRFgdD2L4vdWfAfPh8jQL56ENBE0MLtMMKDtvODn7QNJodCVOUUrv1m7zcFQEIdmcn2+khMg8bVNLjLCxFb/OFwFhIlWEVp2cBTfsCA3edxnao56wBD2S1HC0+T4PBHA4q7QO0uU2ErcmHRk/jZNm5GiCpd9aS7zvNd7MmOrwEElGNCaDt4OAQsVO5uyVvMB75yGYMcIA4Ngzhlu0mQPa0pJeegy8tV/3LbA663lcmVxoMBUPjSvk40RIALSgM1UFdB8uunHYtwvkdi89aTIQs2gYKgl9EPII8BZsYDEIgXGbJdJfctARKTo+Sxwpyq+ufynBTY7URgolxQbs4aqaX6iZAydrFWYIdTUIVd2TYuGO7TeHcB8E3hj/OSCc87FgvO+vqpWhlq4GVU6P109VTRcGLxS+UeI6peMCOh9vaSuzUuCLac1ogHE+7RAg/zxE1wGW0Jr599RZpM5A+sd4TMNv8qR/HL2YdJ0c6MesCAdaWG5h3DsRb87CDyhpYP5/ZeVoRfLoSwk8QmY1qLYA6QsTDHyElpaxDhF1Axx2G7ac06CzFxDKhGAr+8m/RLyGy5ikyKwxwabsZzVtpR7mYxCbL8l7N5Y8ahC RJnGO6XW 2toyaU8/gZ5Spj3ohmZnuRt4egSTevBafC5eQ0Zz4jsPtz9D+tGEp5RKHYloF32W0vNzN73WlKat+XyYNLl2pI4vLt0MdIGtgvR6sjRZaR1y/+HGLi8GA0gyPov1msZRE9RTOMawvEI8ejVSf/jFUapUE/qNlnL1ieJK4kU9Tl9S/VA0Apkd8lZlmSk4641p7aQ0wil2rLwAw4oHx9rrFAwqVS4BpnNNjc8CgVtQJnBrPYHU6kamksLptozqzypZSG1oOrvEGUtET3ISG/AsWIrZAvtqODQzES0UH7w/sB+80J2B3WRjS95bhQV1PtHLRYbF22BHsapzc7YU66k9dfATGpvpLyUCciAKA8CUfthRk9IZEBISRY7XgXYbyVKrcxc/OZr/Z6JiCghRy+ItkktJHPwtW3Va9Dfo0H4AGv0qSBg+r6vIg2LnLrgaSwZYW1VX8gVLNT/Us5wJgpRVTtKtRq37kRiS6LxEe/q/Sc0bH6qLZ0Fej0EsYyKYlFzV77KVcY2uGigrITpdAI7pN8A3s2g== 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 A new step to replace pgtable_t by ptdesc, also a preparation to change vmf.prealloc_pte to ptdesc too. Signed-off-by: Alex Shi Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org Cc: Andrew Morton Cc: Matthew Wilcox --- mm/filemap.c | 2 +- mm/internal.h | 2 +- mm/memory.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d62150418b91..3708ef71182e 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3453,7 +3453,7 @@ static bool filemap_map_pmd(struct vm_fault *vmf, struct folio *folio, } if (pmd_none(*vmf->pmd) && vmf->prealloc_pte) - pmd_install(mm, vmf->pmd, &vmf->prealloc_pte); + pmd_install(mm, vmf->pmd, (struct ptdesc **)&vmf->prealloc_pte); return false; } diff --git a/mm/internal.h b/mm/internal.h index 7a3bcc6d95e7..e4bc64d5176a 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -320,7 +320,7 @@ void folio_activate(struct folio *folio); void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas, struct vm_area_struct *start_vma, unsigned long floor, unsigned long ceiling, bool mm_wr_locked); -void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte); +void pmd_install(struct mm_struct *mm, pmd_t *pmd, struct ptdesc **pte); struct zap_details; void unmap_page_range(struct mmu_gather *tlb, diff --git a/mm/memory.c b/mm/memory.c index cbed8824059f..79685600d23f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -418,7 +418,7 @@ void free_pgtables(struct mmu_gather *tlb, struct ma_state *mas, } while (vma); } -void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte) +void pmd_install(struct mm_struct *mm, pmd_t *pmd, struct ptdesc **pte) { spinlock_t *ptl = pmd_lock(mm, pmd); @@ -438,7 +438,7 @@ void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte) * smp_rmb() barriers in page table walking code. */ smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */ - pmd_populate(mm, pmd, (struct ptdesc *)(*pte)); + pmd_populate(mm, pmd, *pte); *pte = NULL; } spin_unlock(ptl); @@ -450,7 +450,7 @@ int __pte_alloc(struct mm_struct *mm, pmd_t *pmd) if (!ptdesc) return -ENOMEM; - pmd_install(mm, pmd, (pgtable_t *)&ptdesc); + pmd_install(mm, pmd, &ptdesc); if (ptdesc) pte_free(mm, ptdesc); return 0; @@ -4868,7 +4868,7 @@ vm_fault_t finish_fault(struct vm_fault *vmf) } if (vmf->prealloc_pte) - pmd_install(vma->vm_mm, vmf->pmd, &vmf->prealloc_pte); + pmd_install(vma->vm_mm, vmf->pmd, (struct ptdesc **)&vmf->prealloc_pte); else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd))) return VM_FAULT_OOM; }