From patchwork Tue Jul 30 06:46:59 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: 13746743 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 08FF8C3DA61 for ; Tue, 30 Jul 2024 06:43:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9527C6B0099; Tue, 30 Jul 2024 02:43:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DBAE6B009A; Tue, 30 Jul 2024 02:43:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7556B6B009B; Tue, 30 Jul 2024 02:43:58 -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 52A9A6B0099 for ; Tue, 30 Jul 2024 02:43:58 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 023A28012D for ; Tue, 30 Jul 2024 06:43:57 +0000 (UTC) X-FDA: 82395478956.22.7403F3E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 4F2F4180010 for ; Tue, 30 Jul 2024 06:43:56 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sF6QdOTY; spf=pass (imf16.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=1722321781; 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=HhwERUO+IM4mB7PzboyLOtunZRXxHwUhLGD406RytDg=; b=1posZp+jzgBO4hk56Cdf1fcxURvM4MGThsVIk53OU59i+c1gM+W9Cf3ku8t+l+bZLFKDqK TS6ajLt8Zy8d/g7QLzqP5kV//NGS405cdatNW94MAAbBGTk+oioEFFi0In4HIN3MjDFJ2I Qf8qpWr03GRsFvpPgWtl/8L9j34MIiA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722321781; a=rsa-sha256; cv=none; b=5yki7paXNCpR8sI80abSwts2ckX9CAE17c6ZjywpF/Iciz15hEYD1doowoyP7vLQml5xU4 VXEpUCOKAYaCECSZaWzN25vBjmyrNSzjhyFh2Z9SSdGelDJEBR1M28k8/n47lhOy6aRhCl 6XgAEHRlbBArfzcytqv2j6flNn+N22s= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sF6QdOTY; spf=pass (imf16.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 6F55661D93; Tue, 30 Jul 2024 06:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33505C4AF10; Tue, 30 Jul 2024 06:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722321835; bh=liNll9iqljHOGZGyoe5+iBjU60hIZmqEawxmeeNx05k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sF6QdOTYXsuhZ5/wKcNXr1fpLi2Nc7NTYTTlW0GyhipNPb/9ArXCaTfUMRF4glafN ERGFWbhPiJp0rpmYk//9iOQ4Y6AWC6KbdqdnXw9EAsyfZb9SiKLpZrjeJa4W887xAU iVeioOBZRlSigQTkAI1svU6u1CTnxum7RI995sRZM+TABKT73TI9KeunNb+F7Daix0 V49XC5PL7gFKWpc7LTU2ULT4wVE0DoSUB5onWtjcXwdrpZRUDJf6X0eNb/eT2TMkmJ 5rFakvhSK2oYTuzfh3G24YHCdvf2JT6UzyA+rwvZu+uZaNsor+hHhabSQIlD9nTc6+ JA10DmcfN2EZw== 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 , Andrew Morton Subject: [RFC PATCH 05/18] mm/thp: use ptdesc in do_huge_pmd_anonymous_page Date: Tue, 30 Jul 2024 14:46:59 +0800 Message-ID: <20240730064712.3714387-6-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240730064712.3714387-1-alexs@kernel.org> References: <20240730064712.3714387-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 9q9c95zx8pucwmmc8zt4uixsq1yi1e5w X-Rspamd-Queue-Id: 4F2F4180010 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1722321836-307235 X-HE-Meta: U2FsdGVkX1/27ly0EHKHFqhW3EKGRPdgp2g8uP3CT+PdaiyUhS0bTYOsefGH/8vaulwv8M+YJcmvc4iFnAtmtnsfLwqTX/QV7A2rlZ/n8GkKEjuJZIu+TRitZDvs2TP+AFLXFgn+/8qwsqdcn7tKtfa+NnKSe0l4mRimJRg28QELv5kM+K0w3DjJDQuhLGlzvxkzAnbBnO2lXY3KETaB5QMF0hTYZFvhSWcE5NUt3KGAtPAKNROW/B30+eoqIcvun7EfiVm6838PP4BjDrOF11lI0n2tJObpxTEt4Tr9XRVCxlGe8NgbKN8uOuXwjYGIxKIzmvwDi7XhHsyx4tgaocFMTgFk4X5gSYErXnLOOJ/UU6fiQ06fVxFkrCYH0iG/5fP0o//60NfRNzrjOr4QzafECf95/hhoVWAwyh0cvvnR3hrdA71MSNnYQfXacJf17h1sgVXNVNlFtA9Prfs8x8OaZcQsrXJVzMIRrifzJ7JcExRxFy9W9yJfwl1pK1z4XpTW9wrE0scwp5YV+o+dSya/28q+p6DO2rT1WU0hbOeX0db/CNwbMcM8Py0PtuWs3D3t0VdZ1gzDcxeGVHGrmdRR+/R927jjHJ7QdzTCNog9224w84KhMRncAysokOhiJqwMgTbM1vgJ4ilLV1anjHkzg15QKApKYum7pnHE3aGEjRH+OFQcbwD0uLpdpFqhbF8ix852y1AX42dpm2e7gunRTRRsXSodixPuTyYyOkkVhjW6AZHEe2d9YhCgmYSdVYfo+mf6FG9oV2fJJrgTit+HGuF5HzVRoy0hom/w4eFst+EXfWs+ZNyR2CKPpwdu0XsOP/RTSwzgQ2M7uyiazoh6W2j+6w3M0Ymo0tLM9xpsGLkXwe0Pd+eheRHGqRqMT91p3Eq6mggHx3mi1Rmf/wXP1/kbx131HWTierBWDln+hz0aCgEXHA+04ymVG9ntzNGwa/YKTC73wW+JAeD jVuUsQfJ fH4ysss9V5WWkPiSAP9vahyytdbh5OiFHJw24tzKsny+7mQQBwqSEz+haucCfGJpIRNYrtCpI35dRK8bJbRYWNrlqI9xhIQoQNkGOAZC/BTqxRZjrg8Vm3FgltDMfLNSnO7pwZTI7d8+37IgCSSgtvM+nNBvCO/A8vvTEoXa+Hqsok3n7Q+l9i+ej4CVM7YLz2mcbhEsKgo2WEXtB9VY00W+P64IHovOagVe3SEAaYOK/Cu7Wq3JKB20zfwMPXFJESx3SyAc+jQcx7BFX+KOL3+A48DMhyoMUuI4H6MzXhfiDFha6PhRsLiZPsuwqe6av23conO+rVGF1lpgaVcySIKbDFHWprwnlQeZb30VqhvHsOvuKl5rerr5u5FBNbcybZZsNUdF9kBZQ6CtTZTncYmHRfFmqoIMRGVpqv5ghX4fAuCF5FpMjXXStM69LNv0AdAP+nkKqsg0S+2ew670qdmHtgA== 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 ince we have ptdesc struct now, better to use replace pgtable_t, aka 'struct page *'. It's alaos a preparation for return ptdesc pointer in pte_alloc_one series function. Signed-off-by: Alex Shi Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Andrew Morton --- mm/huge_memory.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0ee104093121..d86108d81a99 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1087,16 +1087,16 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) if (!(vmf->flags & FAULT_FLAG_WRITE) && !mm_forbids_zeropage(vma->vm_mm) && transparent_hugepage_use_zero_page()) { - pgtable_t pgtable; + struct ptdesc *ptdesc; struct folio *zero_folio; vm_fault_t ret; - pgtable = pte_alloc_one(vma->vm_mm); - if (unlikely(!pgtable)) + ptdesc = page_ptdesc(pte_alloc_one(vma->vm_mm)); + if (unlikely(!ptdesc)) return VM_FAULT_OOM; zero_folio = mm_get_huge_zero_folio(vma->vm_mm); if (unlikely(!zero_folio)) { - pte_free(vma->vm_mm, pgtable); + pte_free(vma->vm_mm, ptdesc_page(ptdesc)); count_vm_event(THP_FAULT_FALLBACK); return VM_FAULT_FALLBACK; } @@ -1106,21 +1106,21 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) ret = check_stable_address_space(vma->vm_mm); if (ret) { spin_unlock(vmf->ptl); - pte_free(vma->vm_mm, pgtable); + pte_free(vma->vm_mm, ptdesc_page(ptdesc)); } else if (userfaultfd_missing(vma)) { spin_unlock(vmf->ptl); - pte_free(vma->vm_mm, pgtable); + pte_free(vma->vm_mm, ptdesc_page(ptdesc)); ret = handle_userfault(vmf, VM_UFFD_MISSING); VM_BUG_ON(ret & VM_FAULT_FALLBACK); } else { - set_huge_zero_folio(pgtable, vma->vm_mm, vma, + set_huge_zero_folio(ptdesc_page(ptdesc), vma->vm_mm, vma, haddr, vmf->pmd, zero_folio); update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); spin_unlock(vmf->ptl); } } else { spin_unlock(vmf->ptl); - pte_free(vma->vm_mm, pgtable); + pte_free(vma->vm_mm, ptdesc_page(ptdesc)); } return ret; }