From patchwork Tue Jul 30 06:47:04 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: 13746748 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 57CA4C3DA61 for ; Tue, 30 Jul 2024 06:45:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE8176B0095; Tue, 30 Jul 2024 02:45:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D218C6B00A3; Tue, 30 Jul 2024 02:45:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B76036B00A4; Tue, 30 Jul 2024 02:45:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 96DAE6B0095 for ; Tue, 30 Jul 2024 02:45:10 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4610DC010F for ; Tue, 30 Jul 2024 06:45:10 +0000 (UTC) X-FDA: 82395481980.20.734B3F6 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 959CB4001F for ; Tue, 30 Jul 2024 06:45:08 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=otPDGIS+; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722321904; a=rsa-sha256; cv=none; b=Pk3yrMVbownHyJFsLmmb85d/JzxlLsA8hiZ0MzCEReOTszbmm/xTogzPrTS5m9FQggyiRT 03K5JVazHpWIAClMTo7g8yLoqRWuBC/bGI8RJ4SkE33ZEMC/g3rkTv/PYiQHeUvZUKhR40 nT8RIDJTOIAMIo/WFjKilCXr9f8Y9Sk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=otPDGIS+; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722321904; 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=6/I5nPVgEbBdBsGtoUJqw/Mqrhpj6M9NudyLZjepKw8=; b=v9fhagANHzzodAD/bN3h+YCTd1vuJg+1MgELEEkt1atkKR65GEnCC/C5APMWTxZ6CfFiwv EPnM4O8oOUDwFhYN4/T1g1GorOotJktUZKvTfPZvZ5t42Z9vxSEDBZA6WJtYCP3TSKOxMX 3I6Ibzi3AAkDKUIeBVww4tYw51z7IxE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B9AE160B97; Tue, 30 Jul 2024 06:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59076C4AF0E; Tue, 30 Jul 2024 06:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722321907; bh=W5tYBso4UoPS/fKSVOluC4Ch4cJZaP/H2xHcE2b1FHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=otPDGIS+BP+zJU1WerV1XStPgq7KbeiiHRdcUEyZGtj4yf/zK6A7xDzbi5ECaayAt YVSoB/3bQTSLE8x8/QN40AJ0s2PdSq3df6HoYbaIj4z13Vl5vZw9N5ye4PEjdht//7 bqv0egHAAAYkaLavBipdxSHoduTULRxYgtDM4b4mjLw9jYnjamZKyZ8Y6tyDakNpzC Y0Ij1GnGY4gY870o0InOzrbMFIggAcxm9mvmF741jpwmx9ZohF6o5cMeki7Psq4dLD /4dfI13pYO7FfkQIWJrOHrtaZ1MHS6fgo+N7tVvA1Q6NzphZJuPFR1n3WFSvbuCYFD UKCxIcO9HG0sA== 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 , nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org, sparclinux@vger.kernel.org, Bjorn Helgaas , Arnd Bergmann , Christian Brauner , Alexander Viro , Jan Kara , Dan Williams , "David S . Miller" , "Naveen N . Rao" , Dawei Li Subject: [RFC PATCH 10/18] mm/pgtable: pass ptdesc to pte_free() Date: Tue, 30 Jul 2024 14:47:04 +0800 Message-ID: <20240730064712.3714387-11-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-Rspam-User: X-Rspamd-Queue-Id: 959CB4001F X-Rspamd-Server: rspam01 X-Stat-Signature: 1r9dr1bi4wyw1zfiu3p5aqcb4tpbkmxt X-HE-Tag: 1722321908-520132 X-HE-Meta: U2FsdGVkX18bCpUQx7VIsMSjCroLJ3NDzs7+c+K3PHOmDFlZGAQVOxKM5d5LLvKnrvwmEURi0B9aU1fVJwpLoTw/eXEDBRQhyYDSTta9gpRzEY02drQGsniJCD8NqlWucNc9wm2oj1KK8AOeuGR4on8ouLIogTJt/VzXMdXjfSgZAL2gflQef6p37BYPFm0sJdTylKDaSibb4gGsEfsoLRReHAmgX7fljQyWB73Zmkce1jaaNEW8XVfgoiNiIT0xwrKhe/xNryLD+PMcnAcdM8UoeNtOkWvXteLvCmOl14a9w/6EDd2F0ajv6iCi+XCENnOVYsSfHRRLiHJm1IJ3gXX3Lv/2PIdwNq44YHkoo6/OVzLoKxEnK4IXyQgppz81Y42xtPCsC6pGX4fv2CwcZNk6esce6eTAXjIG56PdAttjt+oArXymadLc1/ZcWAkJgPP+bMWg0tsn9MKZykSQb8y3w6Cp7UaVeHGpLuiTrGGm/orRCO5GxvBw0YxBcY+hezzzH1H9yXZY9qSE2BzFOG+ceymFiOsRJy2+l9LVSdPMUmiOnL0j8nPgTNNSc3TKycv+hs/BaWLPqbQKJ8rXprBUywkRaysPSJBwJ18QPN1xtRXPLN1Nv7up5mesdrK65KcGQJJkqaA2YP+KxTTvnYW4uo+H15m7MuWGyCrQPhc8n8wl9Pnz8pj0joymaSLr6DaB4vzmBOKrcG332SVUsOW9gRHyeOOfwKSY8SLOrVrEokC++B5UWOE5r74ecHUa+om4tKT0U2T/g7EaWJjlMwREGA7g583v27luB6etTMuht9WJWy6FOFF6MVGVFxc8Ky6m3dCe5UoZk3x6jOjUqRRMckrFIf0mx0qytfiQPXUgA29gOmWxnHwwqPXJaxE2RkUQhjvCIySfs3VizcfdtGNhDVEND0moh6CRoMiXcHWvgOwHMihzqfufbdCUZ7kliGixwBOSX+liC/NzQLF fMO90eSm Ig+VikSFfdsqcbUEGwxjxvLJQiNTZtXIa/FrbnO/3ajqn/ZnM6I1SBnWZ47duQZzf4ZP6OuCLtu0IMaEzZJvt7BfBRDFMEjxGlYLOjFf7ESxaH6nT6uOshlgnNVt887qBO4oDpM/3igyGxjGF9hT8ZoWz/CIPsIEshV6aWorx2GNtFmV2l1qVvDGJHz34bFNglEXLaEauH50x/KFYqAo9UwKmKeP/g1io/aCH5vO2v0RBz6C6t7CJPcrOg5FH8D7J1B8d5+VzrnZF9oWtlWRJjmC2uj34IFqe2XuDy4zFEfXewLDuTejs8scfGtOhaRj4bDHjvtTwwXrA6+6dIp+tACVYab9PFbSnstt0irlW9gQueWH3+hNjYvkRnE7iNrDYbx1xAMBlKFjDMtJ1sWng+Lx34qDNpTjSV2dTDDj90sQFTSRNvBVxKpBPDv85qXHm9LkSybGkJaNyAvc1vVhgs1uNbHeZu+WX67tApwhyhHSWZ8BXAiGIhOcnz+sGTQU/n1rsqXfkc4hkLGP0ntbLf9NyU6KVSVFWRR6j3wz/1GUk0gCJPCGLKz7ukKfjBHQMZThAdxurp3d5ePg3p4oLO9vhLVpFCpNoLJOyCSFHrO8ki+Ti7Gpu3xOQCDs2uct1aqfsQSErjBxKbhzaxLFoYmihPeET48I3DBv4TMPtDcRXVhU2DgG7bJFFvgiSr+mLcUBne4nm/Zoak7UcUV12j6owIkC6G6jOXEBdl5Y2KF13TncmTvbzdoNQBldc3TKBpfcmXINkwzdCTIw7eDcasaHdZdTm7ve/wf94pkN4ySfGUZDjAKYvixsSGjr/Gi1ofXd65LBayKEuny0zAWgKX74nxOPlHg7cd6CGyNJ1NC/atI5+gPFYHOrYqHdwlXVPtbisnuckaFOOwsuruDx/uZpXMVZcZP4pVA20A1D62cxxX2k= 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 Now we could remove couple of page<->ptdesc converters now. Signed-off-by: Alex Shi Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: nvdimm@lists.linux.dev Cc: linux-fsdevel@vger.kernel.org Cc: sparclinux@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-m68k@lists.linux-m68k.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: Bjorn Helgaas Cc: Vishal Moola Cc: Arnd Bergmann Cc: Christian Brauner Cc: Alexander Viro Cc: Jan Kara Cc: Matthew Wilcox Cc: Dan Williams Cc: David S. Miller Cc: Naveen N. Rao Cc: Christophe Leroy Cc: Nicholas Piggin Cc: Michael Ellerman Cc: Geert Uytterhoeven Cc: Russell King Cc: Mike Rapoport Cc: Dawei Li Cc: Hugh Dickins --- arch/arm/mm/pgd.c | 2 +- arch/m68k/include/asm/motorola_pgalloc.h | 4 ++-- arch/powerpc/include/asm/book3s/64/pgalloc.h | 2 +- arch/powerpc/include/asm/pgalloc.h | 2 +- arch/sparc/include/asm/pgalloc_32.h | 2 +- arch/sparc/mm/srmmu.c | 2 +- fs/dax.c | 2 +- include/asm-generic/pgalloc.h | 4 +--- mm/debug_vm_pgtable.c | 2 +- mm/huge_memory.c | 20 ++++++++++---------- mm/memory.c | 4 ++-- mm/pgtable-generic.c | 2 +- 12 files changed, 23 insertions(+), 25 deletions(-) diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c index f8e9bc58a84f..c384b734d752 100644 --- a/arch/arm/mm/pgd.c +++ b/arch/arm/mm/pgd.c @@ -168,7 +168,7 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd_base) pte = pmd_pgtable(*pmd); pmd_clear(pmd); - pte_free(mm, pte); + pte_free(mm, page_ptdesc(pte)); mm_dec_nr_ptes(mm); no_pmd: pud_clear(pud); diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h index 74a817d9387f..f6bb375971dc 100644 --- a/arch/m68k/include/asm/motorola_pgalloc.h +++ b/arch/m68k/include/asm/motorola_pgalloc.h @@ -39,9 +39,9 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm) return get_pointer_table(TABLE_PTE); } -static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) +static inline void pte_free(struct mm_struct *mm, struct ptdesc *ptdesc) { - free_pointer_table(pgtable, TABLE_PTE); + free_pointer_table(ptdesc_page(ptdesc), TABLE_PTE); } static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable, diff --git a/arch/powerpc/include/asm/book3s/64/pgalloc.h b/arch/powerpc/include/asm/book3s/64/pgalloc.h index dd2cff53a111..eb7d2ca59f62 100644 --- a/arch/powerpc/include/asm/book3s/64/pgalloc.h +++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h @@ -162,7 +162,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, } static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, - pgtable_t pte_page) + struct ptdesc *pte_page) { *pmd = __pmd(__pgtable_ptr_val(pte_page) | PMD_VAL_BITS); } diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h index 37512f344b37..12520521163e 100644 --- a/arch/powerpc/include/asm/pgalloc.h +++ b/arch/powerpc/include/asm/pgalloc.h @@ -40,7 +40,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) pte_fragment_free((unsigned long *)pte, 1); } -static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage) +static inline void pte_free(struct mm_struct *mm, struct ptdesc *ptepage) { pte_fragment_free((unsigned long *)ptepage, 0); } diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h index bc3ef54d9564..addaade56f21 100644 --- a/arch/sparc/include/asm/pgalloc_32.h +++ b/arch/sparc/include/asm/pgalloc_32.h @@ -71,7 +71,7 @@ static inline void free_pte_fast(pte_t *pte) #define pte_free_kernel(mm, pte) free_pte_fast(pte) -void pte_free(struct mm_struct * mm, pgtable_t pte); +void pte_free(struct mm_struct *mm, struct ptdesc *pte); #define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) #endif /* _SPARC_PGALLOC_H */ diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 60bb8628bb1f..05be7d86eda3 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -365,7 +365,7 @@ struct ptdesc *pte_alloc_one(struct mm_struct *mm) return (struct ptdesc *)ptep; } -void pte_free(struct mm_struct *mm, pgtable_t ptep) +void pte_free(struct mm_struct *mm, struct ptdesc *ptep) { struct page *page; diff --git a/fs/dax.c b/fs/dax.c index 51cbc08b22e7..61b9bd5200da 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -1246,7 +1246,7 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, fallback: if (ptdesc) - pte_free(vma->vm_mm, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); trace_dax_pmd_load_hole_fallback(inode, vmf, zero_folio, *entry); return VM_FAULT_FALLBACK; } diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index 1a4070f8d5dd..5f249ec9d289 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -105,10 +105,8 @@ static inline struct ptdesc *pte_alloc_one_noprof(struct mm_struct *mm) * @mm: the mm_struct of the current context * @pte_page: the `struct page` referencing the ptdesc */ -static inline void pte_free(struct mm_struct *mm, struct page *pte_page) +static inline void pte_free(struct mm_struct *mm, struct ptdesc *ptdesc) { - struct ptdesc *ptdesc = page_ptdesc(pte_page); - pagetable_pte_dtor(ptdesc); pagetable_free(ptdesc); } diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index e4969fb54da3..f256bc816744 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -1049,7 +1049,7 @@ static void __init destroy_args(struct pgtable_debug_args *args) /* Free page table entries */ if (args->start_ptep) { - pte_free(args->mm, args->start_ptep); + pte_free(args->mm, page_ptdesc(args->start_ptep)); mm_dec_nr_ptes(args->mm); } diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 6274eb7559ac..dc323453fa02 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -987,7 +987,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, if (userfaultfd_missing(vma)) { spin_unlock(vmf->ptl); folio_put(folio); - pte_free(vma->vm_mm, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); ret = handle_userfault(vmf, VM_UFFD_MISSING); VM_BUG_ON(ret & VM_FAULT_FALLBACK); return ret; @@ -1013,7 +1013,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, spin_unlock(vmf->ptl); release: if (ptdesc) - pte_free(vma->vm_mm, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); folio_put(folio); return ret; @@ -1096,7 +1096,7 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) return VM_FAULT_OOM; zero_folio = mm_get_huge_zero_folio(vma->vm_mm); if (unlikely(!zero_folio)) { - pte_free(vma->vm_mm, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); count_vm_event(THP_FAULT_FALLBACK); return VM_FAULT_FALLBACK; } @@ -1106,10 +1106,10 @@ 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, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); } else if (userfaultfd_missing(vma)) { spin_unlock(vmf->ptl); - pte_free(vma->vm_mm, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); ret = handle_userfault(vmf, VM_UFFD_MISSING); VM_BUG_ON(ret & VM_FAULT_FALLBACK); } else { @@ -1120,7 +1120,7 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) } } else { spin_unlock(vmf->ptl); - pte_free(vma->vm_mm, ptdesc_page(ptdesc)); + pte_free(vma->vm_mm, ptdesc); } return ret; } @@ -1178,7 +1178,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, out_unlock: spin_unlock(ptl); if (ptdesc) - pte_free(mm, ptdesc_page(ptdesc)); + pte_free(mm, ptdesc); } /** @@ -1414,7 +1414,7 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, #endif if (unlikely(!pmd_trans_huge(pmd))) { - pte_free(dst_mm, ptdesc_page(ptdesc)); + pte_free(dst_mm, ptdesc); goto out_unlock; } /* @@ -1440,7 +1440,7 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, if (unlikely(folio_try_dup_anon_rmap_pmd(src_folio, src_page, src_vma))) { /* Page maybe pinned: split and retry the fault on PTEs. */ folio_put(src_folio); - pte_free(dst_mm, ptdesc_page(ptdesc)); + pte_free(dst_mm, ptdesc); spin_unlock(src_ptl); spin_unlock(dst_ptl); __split_huge_pmd(src_vma, src_pmd, addr, false, NULL); @@ -1830,7 +1830,7 @@ static inline void zap_deposited_table(struct mm_struct *mm, pmd_t *pmd) pgtable_t pgtable; pgtable = pgtable_trans_huge_withdraw(mm, pmd); - pte_free(mm, pgtable); + pte_free(mm, page_ptdesc(pgtable)); mm_dec_nr_ptes(mm); } diff --git a/mm/memory.c b/mm/memory.c index 37529e0a9ce2..3014168e7296 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -451,7 +451,7 @@ int __pte_alloc(struct mm_struct *mm, pmd_t *pmd) pmd_install(mm, pmd, (pgtable_t *)&ptdesc); if (ptdesc) - pte_free(mm, ptdesc_page(ptdesc)); + pte_free(mm, ptdesc); return 0; } @@ -5196,7 +5196,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, vmf->prealloc_pte); + pte_free(vm_mm, page_ptdesc(vmf->prealloc_pte)); vmf->prealloc_pte = NULL; } return ret; diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index f34a8d115f5b..92245a32656b 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -241,7 +241,7 @@ static void pte_free_now(struct rcu_head *head) struct ptdesc *ptdesc; ptdesc = container_of(head, struct ptdesc, pt_rcu_head); - pte_free(NULL /* mm not passed and not used */, (pgtable_t)ptdesc); + pte_free(NULL /* mm not passed and not used */, ptdesc); } void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)