From patchwork Tue Jul 30 07:27:18 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: 13746824 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 B3A8CC3DA61 for ; Tue, 30 Jul 2024 07:24:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1281B6B009E; Tue, 30 Jul 2024 03:24:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B1C76B00A0; Tue, 30 Jul 2024 03:24:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E465E6B00A1; Tue, 30 Jul 2024 03:24:01 -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 C12C36B009E for ; Tue, 30 Jul 2024 03:24:01 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 721708014E for ; Tue, 30 Jul 2024 07:24:01 +0000 (UTC) X-FDA: 82395579882.26.FBCDFCE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id BC96BC0005 for ; Tue, 30 Jul 2024 07:23:59 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Umdw1n/4"; spf=pass (imf22.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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=1722324186; 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=l7P6kCekz50cjOXgl6s+eDKzlP2kEjYr+MUOAanzUJE=; b=UhkLFdZIgG1DPI1jKHtsZyRXhG5GyWxCHdGJEKxyWtnhG3OSNSDZ01iMeGVLKtjfOxHZ9K ibtz6AYVcTDUzFNruaVAhbK+E3jAm0+hVmdEys+UfRIkFjfyIBVi6fcnD2kKItaFCbVHlY 0dBLoTTRkl+VzWwBa7NUCbs6VHNAMds= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722324186; a=rsa-sha256; cv=none; b=OT7pDFHEUODTj62/N7K1RF/Fnw7qb7u5SnNx9x4goosMgtolgCTXqaSI/2jaSM5QrmuMom 0HIVjTpWnsdbgyqx2l8FXnFygrYKD4MaSVBvcQ8r8oSzx+C3FWBpgEjgwBhYtU9vNLAOaG WB60LWxCsX1IZPtlnEkONBgehDiC4xs= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="Umdw1n/4"; spf=pass (imf22.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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 dfw.source.kernel.org (Postfix) with ESMTP id EE2E161E00; Tue, 30 Jul 2024 07:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B0D5C4AF0F; Tue, 30 Jul 2024 07:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722324238; bh=hohz5++xhGxNDKVPZKJqUhh7A1cYUT79OYxYo7u11yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Umdw1n/4ZRW6vj4XY31OqgNYPiPhAbZlbgkm463jfeKHwogT02Y63bxfSFWNs6V7i IbJVXhKCJIDwUUeMqi8R0XrMXUHiugWfyCxKZqI770IZLjiuICkEJnn+DmK0S0wtXg wUCiuEnqytXfwcqqtWz5fOkHF+luguzZyWaFMoJ4rhle5cDdQdyE5uQaHGo1ueEOcb h/0PAa/PMRqHVn0XqkQbLbFosheXAJ2bz8RLIDCtPfwms57k82sGo6pfGja5YC1oQa kpLBBVhBZpJMpUdVnsCBJv3mecb+/z0M1D++yUjl5E3rrcM36nTFGIo1ZUq4uLWm+B aAD8huEqWxnFw== 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 17/18] mm: convert vmf.prealloc_pte to struct ptdesc pointer Date: Tue, 30 Jul 2024 15:27:18 +0800 Message-ID: <20240730072719.3715016-7-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-Rspamd-Queue-Id: BC96BC0005 X-Stat-Signature: bmxcrrupbj5qj6ki34wnofzaejt13z7c X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1722324239-786834 X-HE-Meta: U2FsdGVkX1/i9riWSn4gaezGTAlCTTQV+58k/WykWDQjZLmLSjxIBuZq6mW0g7XekWJ4V7A0VGDO3YGO5khG/L1Jg27FROoosK17RErcYolvSQZ3xkYw+LG38etDdpRVAYf/OMMZpZPR8j3uzdyNlSZebUu7XvwH5Tn+gHO31swU/w8NuyALUzRD3ytV57HVnxtYPR1zBQ9Mp0oINtNudWG8gimSXsSw6eigP5qNNdAdEmbbd+xxQkXLHyS5L+OubzCM19QttDiZFctI8OkcwvJHwDHSvK3lG4rpxvM7YGymN7D7cKZzoqkupwGSG+ZWFY4rcJyJRoXF+m55YlOEz2/SgsxLZTwvB5EvXlsxxlKOCwbeO7oWYMxYwQovWmTAlMdCiuWkOVps1NbtL06U9OwwQ71jnrjRp1xwsLvAKoUIVKlUpOVbfTvj3lmNuS2Bsw92Q8yG+m+kkXhiwd/XPOeRh1B/UKYQv6JpeNVVB9l2lAULZ4lhN+ogJhTCbR9VVnSXEmuhFJK8WjK0Xnax3UUxkuW4FGKpGGSLsDEdOsCwZ4Aa77fMY5kpKxxww9DXO0vHzZaewvIFlVrRCAwjfe+C2K6UKBZ9ScWs2uAV0LzXmlF7/RKD0+GvOoVOldFzySsXSeMh2oMZpiqcykfPraiNfSbmm9Iru4J2YRLbyzdgR8X0Td+n+P31H3vwyZSj+R6aoL1dKcQ4LZ12Lync0+yeyTBIr7zUqOfgcHKTR4qmYxlMebXUy5eP8QZ9GclJrkozFvgPqcbiKi6MKGrrPD4QVBBTzWsPYpjoD4hHgrHnwpbDABb+2+tusSUd4P4CnceSJbpHmfYATGGukMcM/nUMPQGiPSsGtSKVCyY/I/XbzDIqwW0wHlvpdL+G/JCFJFZt1OUjJmdcuZwASqFPPRIG2ZsOd5ZIIlnf7uQPg2F1kb4XbdF1hUOuGC4YTyLPvOPNwFQ1HNzSZXvXvsi 2ZKrCIN8 Fpgi/gMU0kBowlJ7p8EIPGJXnd7DBxK2xv0994cCnmYgX79xpZ0agsA1BHKsLn0eYGeoIh8H4sY/vLzMCYMogpBlT9xRWk24ZcFtKUVCOYrzYBIQnPpbLmD2uFDl1oUFq9mj1HWEIVJI/jhEEsXWdu0f39sP3MpIng7vN6o+Q/UWsXdXqvn+155nynt8izZkPeJueqR71wg/kbjCtZPolASZ6oiXULRG4pg4CNxp0jm5FlUM2uqWkl26UdIPyOxD4QHPvtS024Xq2m66fsqhbp+2TyquVv9pDBokBJGkE2n1OOT0xTVjU7w6M2PCkWHEjx4XdweagaziHmzVLzWilJF2Pq78xPvifzzdwz79Du2ZAVOSOus+BYu/GPU27e1Y6Gn48ME0f2p+M3upkGoY/5yLIK9OVj9t8XILXTsH3W/6yE+Fu+z1fvQR5IMTm+3oFVu7+A9KEJOw3DtSAggk3TJvoDwIyDZZ2F0VRw+WIvExrIVpkh4RSRIYJUdpWkCIMlQZmCqOc8/L/VBRoCTUcvNDfGg== 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 vmfs.prealloc_pte is a pointer to page table memory, so converter it to struct ptdesc pointer. Signed-off-by: Alex Shi Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Matthew Wilcox Cc: Andrew Morton --- include/linux/mm.h | 2 +- mm/filemap.c | 2 +- mm/memory.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7424f964dff3..749d6dd311fa 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -567,7 +567,7 @@ struct vm_fault { * Protects pte page table if 'pte' * is not NULL, otherwise pmd. */ - pgtable_t prealloc_pte; /* Pre-allocated pte page table. + struct ptdesc *prealloc_pte; /* Pre-allocated pte page table. * vm_ops->map_pages() sets up a page * table from atomic context. * do_fault_around() pre-allocates diff --git a/mm/filemap.c b/mm/filemap.c index 3708ef71182e..d62150418b91 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, (struct ptdesc **)&vmf->prealloc_pte); + pmd_install(mm, vmf->pmd, &vmf->prealloc_pte); return false; } diff --git a/mm/memory.c b/mm/memory.c index 79685600d23f..1a5fb17ab045 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4648,7 +4648,7 @@ static vm_fault_t __do_fault(struct vm_fault *vmf) * # flush A, B to clear the writeback */ if (pmd_none(*vmf->pmd) && !vmf->prealloc_pte) { - vmf->prealloc_pte = ptdesc_page(pte_alloc_one(vma->vm_mm)); + vmf->prealloc_pte = pte_alloc_one(vma->vm_mm); if (!vmf->prealloc_pte) return VM_FAULT_OOM; } @@ -4687,7 +4687,7 @@ static void deposit_prealloc_pte(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; - pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, page_ptdesc(vmf->prealloc_pte)); + pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, vmf->prealloc_pte); /* * We are going to consume the prealloc table, * count that as nr_ptes. @@ -4726,7 +4726,7 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) * related to pte entry. Use the preallocated table for that. */ if (arch_needs_pgtable_deposit() && !vmf->prealloc_pte) { - vmf->prealloc_pte = ptdesc_page(pte_alloc_one(vma->vm_mm)); + vmf->prealloc_pte = pte_alloc_one(vma->vm_mm); if (!vmf->prealloc_pte) return VM_FAULT_OOM; } @@ -4868,7 +4868,7 @@ vm_fault_t finish_fault(struct vm_fault *vmf) } if (vmf->prealloc_pte) - pmd_install(vma->vm_mm, vmf->pmd, (struct ptdesc **)&vmf->prealloc_pte); + pmd_install(vma->vm_mm, vmf->pmd, &vmf->prealloc_pte); else if (unlikely(pte_alloc(vma->vm_mm, vmf->pmd))) return VM_FAULT_OOM; } @@ -5011,7 +5011,7 @@ static vm_fault_t do_fault_around(struct vm_fault *vmf) pte_off + vma_pages(vmf->vma) - vma_off) - 1; if (pmd_none(*vmf->pmd)) { - vmf->prealloc_pte = ptdesc_page(pte_alloc_one(vmf->vma->vm_mm)); + vmf->prealloc_pte = pte_alloc_one(vmf->vma->vm_mm); if (!vmf->prealloc_pte) return VM_FAULT_OOM; } @@ -5197,7 +5197,7 @@ static vm_fault_t do_fault(struct vm_fault *vmf) /* preallocated pagetable is unused: free it */ if (vmf->prealloc_pte) { - pte_free(vm_mm, page_ptdesc(vmf->prealloc_pte)); + pte_free(vm_mm, vmf->prealloc_pte); vmf->prealloc_pte = NULL; } return ret;