From mboxrd@z Thu Jan 1 00:00:00 1970 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 93E1BE7717F for ; Mon, 16 Dec 2024 12:52:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 284286B0089; Mon, 16 Dec 2024 07:52:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 20C756B008A; Mon, 16 Dec 2024 07:52:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0862D6B008C; Mon, 16 Dec 2024 07:52:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D64EE6B0089 for ; Mon, 16 Dec 2024 07:52:21 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 22FA980D7A for ; Mon, 16 Dec 2024 12:52:21 +0000 (UTC) X-FDA: 82900809516.21.53AEC98 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by imf02.hostedemail.com (Postfix) with ESMTP id 7C13B8000D for ; Mon, 16 Dec 2024 12:51:22 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=YlcR4Fk+; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734353525; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jpVujSgfhyquRi3lcxkjWXtolDAfOmabfZbvo9rKQ0U=; b=cuuzeMAtGhBh/WKeoQ7jc1d03IAO2h3zXFq8frh0FwNn3gN520OiiYvGl80BX0CiumR3ac HRHSJDjAbzenXrhGSnDn1sthxKBVTgNGGsPJ+0yhefI+Jc2wlgV/xIeZDzl3+JmdQpWZs8 j8JCBAgWU2bj9ks3AD4ZHAmZIeiO8UE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734353526; a=rsa-sha256; cv=none; b=1nvk2XIMj56Aq1g69B5O4M7aPC4RhnI8og4UoIbLizCzYTGd6mEkVQqgMW+qlJmEBscn1R /pNzwoL1NMFyqc3Ojb7/pOCUy+H2Ibcb2i/Z7DQHsCcP2xZrKUMheVKtjx+naIVujlJjc1 gWUuqLqdWDnWh8bXeebf7cM7i9AxwXk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=YlcR4Fk+; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.182 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-728eedfca37so4162091b3a.2 for ; Mon, 16 Dec 2024 04:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734353537; x=1734958337; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jpVujSgfhyquRi3lcxkjWXtolDAfOmabfZbvo9rKQ0U=; b=YlcR4Fk+ieVjky9jR3TTtJFYFy2/XNUDRRk2t0+P4skqYKxJAgaiKYTrDmhcyXioDC JlmN3MCtrAQRj26424jdCqA3IYAc3Ew9pTBC70B9kt+QOsapGEKmgsmA1zQqsEZA4nB6 pipsNoMt+jwtnaz50Ow4vy/iDr6rmgRdWYttO5gIEW9qe1FRkiuFC0XcDZO36wWC4blR 00qnyY+eHMoSecQJX+wN/7Xwy7kZWnsdTTorf9wVAS8YWySfQ9RROcqowNck/EdEDJg0 qut51xDN9JCzGQZIE4QnqhxAzxEwRm4T7rgLBCi+21rFKFJCtidA8fKwWIO2SpnZ/ACZ daww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734353537; x=1734958337; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jpVujSgfhyquRi3lcxkjWXtolDAfOmabfZbvo9rKQ0U=; b=pV1C3RLV/wkwUXi2HhK4M6F6IMtmdwAsLA811Ivd9mDKysLT4Gc9uCmts7erwcT3a5 6dBbC9v0WBnW1oYKfaCBe47rdORT2lK/+YMhSwoRHAFPhag504OKrLYuzyfH3Ew2eE4D 6Iu8aoVa3U8iriMhjQvvOWVD57kdSyNKh4voFLDi8BQwn4FwuPlhPT2H95vIyasPpw34 fEHbl4GS7/X2ZapFWjQT80ATRQHc+goTBLAPHlhzIDVCY7Vfnb4d/LLDlDTGjCTnBbSw o4jsEFMc/fuHhBtndfunavNnbZnUd8n7YGk7PjqBanPPh3Xw07PNn7IYCdqDClujQq42 uVMw== X-Forwarded-Encrypted: i=1; AJvYcCXBHDh2/61jmpIpPDTyLwCJQQ8/zPPAtRnAXFnYvWVMpiTo8qE2fRR5pOliN5ZTBlgcWEAzv4XFSg==@kvack.org X-Gm-Message-State: AOJu0Yww5cFYkMD7INVg8Dsp0RAj61iKGhDBSy8KSJRiy+BWXGxHEw8x +7M8t6q4QLXQjb37dJYRaAxncJqaTZe7BSFlB45T3yxuh/BTRVGyGWv9+os8CGk= X-Gm-Gg: ASbGncu7eRw4paXzNkSKMqqlHWZlrTEtlZMAyAWt2rpxgvR2RfIEVDb2BjAhGORBBUi xYb/nU2WkOZnBzH8Gcri3xw/NwukVgI6oWNSR5wEVEXWAo8l8u4GbZfhNo9f5aKUVKsWLwDyBI5 lxf9DfNX7m9skf9YHcfkMgk2RhsJX9/Nabd5xK51HHDJUiwmjRKgHT1l0SwEd4yXe2ALiRjWjtg JrLRSnFKYWIvOqfFLOMuxB7zJYYsjD7gcX2nzGzxlYC2l1BpaKYTRZSNXJATEeary58mEtwlIwb 0UetyQ== X-Google-Smtp-Source: AGHT+IF2FtSfrsbSHuvFmynqJ3lzZ4Jsn1NnQA/IFgalSUJpQVUj9raH/YTN0GW/eEuhU/ngGHHeVw== X-Received: by 2002:a05:6a00:4c83:b0:727:3b77:4174 with SMTP id d2e1a72fcca58-7290c27d95amr19398327b3a.23.1734353535280; Mon, 16 Dec 2024 04:52:15 -0800 (PST) Received: from [10.4.194.102] ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918af0caesm4666395b3a.86.2024.12.16.04.52.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Dec 2024 04:52:14 -0800 (PST) Message-ID: Date: Mon, 16 Dec 2024 20:52:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 11/12] mm: pgtable: introduce generic __tlb_remove_table() Content-Language: en-US To: Peter Zijlstra Cc: tglx@linutronix.de, david@redhat.com, jannh@google.com, hughd@google.com, yuzhao@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, lorenzo.stoakes@oracle.com, akpm@linux-foundation.org, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <271e58cd4ab808c4f402539b76d5916924e2bc6f.1734164094.git.zhengqi.arch@bytedance.com> <20241216120043.GA11133@noisy.programming.kicks-ass.net> From: Qi Zheng In-Reply-To: <20241216120043.GA11133@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: jeoarz5rkamzxgsreuiauwjxtmus43bm X-Rspamd-Queue-Id: 7C13B8000D X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1734353482-262134 X-HE-Meta: U2FsdGVkX191uiun1gmxc3QIYRoTpZ/3RlhdE3upqLhbGG+tennmIeE8GYUd9nGUL5S8fRaED9KaXZXH27v5DJPwrHRLqaXJoHs3CVJC0Tq+4Vx62mHb6X1Zbv+Jlcf0II5J1QNJ2Cgatfy6VgdWaMiC1wInQ84Q8Us7LO48Ng8nOI8p697++DFaG4NRoVU/vFSTAOZDXdrpyec6T8r69RLEodaJpeEHrMSRDrBqNLYm1pJV1ZD1bOa9bttBGT1rbIkDFgLARQYxNavTCyiWXCAyD3cuRfixqDkk3GmRTNhY7B0Cm/fPxRucus9ZoXDx47VXRLnmvbGqGIeb+cFFg2nVnKJbjTj3qnAMyA7mrGl1kq7W+Fktrf0ETUxWVFJ+A9gIakvTMGUIeDq3CgswByjcwFAAy3HuH7cUGiXBvrsgUS/1l4+rkouKZRwuqs+V/E+GWTn/ykB7Kjg8ijjdy2xHDftE4b0JcZSdS0zWu5Y6U18oaPX2Rf9ME7kqK0WzjDJl2IvlmOBuETxq969tZqi3PjfNAqu6tvYDiSj7T2JbimoqF2yGBmVOsa8eBEwjgEvOEr9WpW6UcuvvfhvC6YSzWtv5VD96gYmZJjAUjimAO/1/tq1pbhKDbUEeHEGhyXFCNrWqqlDW4Ia0ra9PNdJEm3RHGAdeOzb9ebreGhOFEN5NrmOmWoPH92IYYSvXu0BqdF1F1XF218ViD5XMEb0whaHnS/hiQlptqrHi/wiSBrvuCaPXthQAU5HJ5QSFA0GUdspKFYv4ZU3+vXLLr3V3NPEKS+B6QZbIELkQDvPWZrVje5g4xpiAcTbdcfM2dYgIueEa6IQlcA8NabEa8O1MLLrX4P/AP4no7/RtwtKipdW2tMM3Or2JQP0LwusDtxQy+EjuFhjZlllq1SmR0fLgT77had27V0816X4xZktBmN0zdJ2Mq7BhOWbaolQC7pb5Rqczx0tUvEGeZor FQGxifX8 VKLmYBQcm29tzYzg7/+CGRXB88I+3Sq96yy9Jl5pEvRW5Nj5d4AfZRNS9li5nwAUXFwEfikGselyEo69npbMB3N0PT9K9wmTsuvW6b+1DYz57rM6cLMOGOl6+7uPAvmqFDngcKZOpHUZDl3w5KH782FphH260oNTBLtbNjspybcP1qYvgP9GYNyqV80jg8vNL6F3IlmY7VK+fGbhAhC6dSno8a2uxGr3v5BYkz/t0gkJpq2zZiewggxw4Qqjmcj7ZWyUaMsBZW929LZ0mtJzhEPpL3HIKNbsAGMyUjYQbd8QNatYASn6sz82cvm0insd0IZzdG3kwBBs0N0waMXmMmtfSg+x2wDTzpIBIN3X2v1YVACndHsSj1f5BdfquxIwGWl3WDrGPNwxuWNGkSU8QzPTCD/c/IxHYbjGuYKmDolGTTSIvwiz+Gel9Sw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.019607, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/12/16 20:00, Peter Zijlstra wrote: > On Sat, Dec 14, 2024 at 05:02:57PM +0800, Qi Zheng wrote: [...] >> >> +#ifndef __HAVE_ARCH_TLB_REMOVE_TABLE >> +static inline void __tlb_remove_table(void *_table) >> +{ >> + struct ptdesc *ptdesc = (struct ptdesc *)_table; >> + >> + pagetable_dtor(ptdesc); >> + pagetable_free(ptdesc); >> +} >> +#endif > > > Spot the fail... > > That said, all this ptdesc stuff is another giant trainwreck. Let me > clean that up for you. It looks like you want to revert what was done in this patch series: https://lore.kernel.org/all/20230807230513.102486-1-vishal.moola@gmail.com/ But why? It seems that splitting ptdesc from struct page is a good thing? > > --- > diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h > index ea4fbe7b17f6..ac3881ec342f 100644 > --- a/arch/arm/include/asm/tlb.h > +++ b/arch/arm/include/asm/tlb.h > @@ -32,8 +32,6 @@ > static inline void > __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) > { > - struct ptdesc *ptdesc = page_ptdesc(pte); > - > #ifndef CONFIG_ARM_LPAE > /* > * With the classic ARM MMU, a pte page has two corresponding pmd > @@ -43,16 +41,14 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) > __tlb_adjust_range(tlb, addr - PAGE_SIZE, 2 * PAGE_SIZE); > #endif > > - tlb_remove_ptdesc(tlb, ptdesc); > + tlb_remove_table(tlb, pte); > } > > static inline void > __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) > { > #ifdef CONFIG_ARM_LPAE > - struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); > - > - tlb_remove_ptdesc(tlb, ptdesc); > + tlb_remove_table(tlb, virt_to_page(pmdp)); > #endif > } > > diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h > index 8d762607285c..4a60569fed69 100644 > --- a/arch/arm64/include/asm/tlb.h > +++ b/arch/arm64/include/asm/tlb.h > @@ -75,18 +75,14 @@ static inline void tlb_flush(struct mmu_gather *tlb) > static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > unsigned long addr) > { > - struct ptdesc *ptdesc = page_ptdesc(pte); > - > - tlb_remove_ptdesc(tlb, ptdesc); > + tlb_remove_table(tlb, pte); > } > > #if CONFIG_PGTABLE_LEVELS > 2 > static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, > unsigned long addr) > { > - struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); > - > - tlb_remove_ptdesc(tlb, ptdesc); > + tlb_remove_table(tlb, virt_to_page(pmdp)); > } > #endif > > @@ -94,12 +90,10 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, > static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, > unsigned long addr) > { > - struct ptdesc *ptdesc = virt_to_ptdesc(pudp); > - > if (!pgtable_l4_enabled()) > return; > > - tlb_remove_ptdesc(tlb, ptdesc); > + tlb_remove_table(tlb, virt_to_page(pudp)); > } > #endif > > @@ -107,12 +101,10 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, > static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4dp, > unsigned long addr) > { > - struct ptdesc *ptdesc = virt_to_ptdesc(p4dp); > - > if (!pgtable_l5_enabled()) > return; > > - tlb_remove_ptdesc(tlb, ptdesc); > + tlb_remove_table(tlb, virt_to_page(p4dp)); > } > #endif > > diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h > index f1ce5b7b28f2..2c0897624699 100644 > --- a/arch/csky/include/asm/pgalloc.h > +++ b/arch/csky/include/asm/pgalloc.h > @@ -64,7 +64,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) > #define __pte_free_tlb(tlb, pte, address) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \ > + tlb_remove_page(tlb, pte); \ > } while (0) > > extern void pagetable_init(void); > diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h > index 40e42a0e7167..8b1550498f1b 100644 > --- a/arch/hexagon/include/asm/pgalloc.h > +++ b/arch/hexagon/include/asm/pgalloc.h > @@ -90,7 +90,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, > #define __pte_free_tlb(tlb, pte, addr) \ > do { \ > pagetable_dtor((page_ptdesc(pte))); \ > - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #endif > diff --git a/arch/loongarch/include/asm/pgalloc.h b/arch/loongarch/include/asm/pgalloc.h > index 7211dff8c969..5a4f22aeb618 100644 > --- a/arch/loongarch/include/asm/pgalloc.h > +++ b/arch/loongarch/include/asm/pgalloc.h > @@ -58,7 +58,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) > #define __pte_free_tlb(tlb, pte, address) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #ifndef __PAGETABLE_PMD_FOLDED > diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h > index 2b626cb3ad0a..63d9f95f5e3d 100644 > --- a/arch/m68k/include/asm/sun3_pgalloc.h > +++ b/arch/m68k/include/asm/sun3_pgalloc.h > @@ -20,7 +20,7 @@ extern const char bad_pmd_string[]; > #define __pte_free_tlb(tlb, pte, addr) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) > diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h > index 36d9805033c4..bbee21345154 100644 > --- a/arch/mips/include/asm/pgalloc.h > +++ b/arch/mips/include/asm/pgalloc.h > @@ -57,7 +57,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) > #define __pte_free_tlb(tlb, pte, address) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #ifndef __PAGETABLE_PMD_FOLDED > diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h > index 12a536b7bfbd..641cec8fb2a2 100644 > --- a/arch/nios2/include/asm/pgalloc.h > +++ b/arch/nios2/include/asm/pgalloc.h > @@ -31,7 +31,7 @@ extern pgd_t *pgd_alloc(struct mm_struct *mm); > #define __pte_free_tlb(tlb, pte, addr) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #endif /* _ASM_NIOS2_PGALLOC_H */ > diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h > index 596e2355824e..e9b9bc53ece0 100644 > --- a/arch/openrisc/include/asm/pgalloc.h > +++ b/arch/openrisc/include/asm/pgalloc.h > @@ -69,7 +69,7 @@ extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); > #define __pte_free_tlb(tlb, pte, addr) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #endif > diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h > index fc50d1401024..baedbd2546b9 100644 > --- a/arch/riscv/include/asm/pgalloc.h > +++ b/arch/riscv/include/asm/pgalloc.h > @@ -26,13 +26,13 @@ > * comment below 'ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE' in include/asm-generic/tlb.h > * for more details. > */ > -static inline void riscv_tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) > +static inline void riscv_tlb_remove_table(struct mmu_gather *tlb, void *pt) > { > if (riscv_use_sbi_for_rfence()) { > - tlb_remove_ptdesc(tlb, pt); > + tlb_remove_table(tlb, pt); > } else { > pagetable_dtor(pt); > - tlb_remove_page_ptdesc(tlb, pt); > + tlb_remove_page(tlb, pt); > } > } > > @@ -120,7 +120,7 @@ static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, > unsigned long addr) > { > if (pgtable_l4_enabled) > - riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(pud)); > + riscv_tlb_remove_table(tlb, virt_to_page(pud)); > } > > #define p4d_alloc_one p4d_alloc_one > @@ -143,7 +143,7 @@ static inline void __p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, > unsigned long addr) > { > if (pgtable_l5_enabled) > - riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(p4d)); > + riscv_tlb_remove_table(tlb, virt_to_page(p4d)); > } > #endif /* __PAGETABLE_PMD_FOLDED */ > > @@ -172,7 +172,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) > static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, > unsigned long addr) > { > - riscv_tlb_remove_ptdesc(tlb, virt_to_ptdesc(pmd)); > + riscv_tlb_remove_table(tlb, virt_to_page(pmd)); > } > > #endif /* __PAGETABLE_PMD_FOLDED */ > @@ -180,7 +180,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, > static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > unsigned long addr) > { > - riscv_tlb_remove_ptdesc(tlb, page_ptdesc(pte)); > + riscv_tlb_remove_table(tlb, pte); > } > #endif /* CONFIG_MMU */ > > diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h > index 705278074034..fba11949dd2e 100644 > --- a/arch/s390/include/asm/tlb.h > +++ b/arch/s390/include/asm/tlb.h > @@ -86,7 +86,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > tlb->cleared_pmds = 1; > if (mm_alloc_pgste(tlb->mm)) > gmap_unlink(tlb->mm, (unsigned long *)pte, address); > - tlb_remove_ptdesc(tlb, pte); > + tlb_remove_table(tlb, pte); > } > > /* > @@ -105,7 +105,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > tlb->cleared_puds = 1; > - tlb_remove_ptdesc(tlb, pmd); > + tlb_remove_table(tlb, pmd); > } > > /* > @@ -123,7 +123,7 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > tlb->cleared_p4ds = 1; > - tlb_remove_ptdesc(tlb, pud); > + tlb_remove_table(tlb, pud); > } > > /* > @@ -141,7 +141,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, > __tlb_adjust_range(tlb, address, PAGE_SIZE); > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > - tlb_remove_ptdesc(tlb, p4d); > + tlb_remove_table(tlb, p4d); > } > > #endif /* _S390_TLB_H */ > diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h > index 96d938fdf224..43812b2363ef 100644 > --- a/arch/sh/include/asm/pgalloc.h > +++ b/arch/sh/include/asm/pgalloc.h > @@ -35,7 +35,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, > #define __pte_free_tlb(tlb, pte, addr) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #endif /* __ASM_SH_PGALLOC_H */ > diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h > index f0af23c3aeb2..aa6063dc5b1e 100644 > --- a/arch/um/include/asm/pgalloc.h > +++ b/arch/um/include/asm/pgalloc.h > @@ -28,7 +28,7 @@ extern pgd_t *pgd_alloc(struct mm_struct *); > #define __pte_free_tlb(tlb, pte, address) \ > do { \ > pagetable_dtor(page_ptdesc(pte)); \ > - tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \ > + tlb_remove_page((tlb), (pte)); \ > } while (0) > > #if CONFIG_PGTABLE_LEVELS > 2 > @@ -36,15 +36,15 @@ do { \ > #define __pmd_free_tlb(tlb, pmd, address) \ > do { \ > pagetable_dtor(virt_to_ptdesc(pmd)); \ > - tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pmd)); \ > + tlb_remove_page((tlb), virt_page(pmd)); \ > } while (0) > > #if CONFIG_PGTABLE_LEVELS > 3 > > #define __pud_free_tlb(tlb, pud, address) \ > do { \ > - pagetable_dtor(virt_to_ptdesc(pud)); \ > - tlb_remove_page_ptdesc((tlb), virt_to_ptdesc(pud)); \ > + pagetable_dtor(virt_to_ptdesc(pud)); \ > + tlb_remove_page((tlb), virt_to_page(pud)); \ > } while (0) > > #endif > diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h > index 939a813023d7..7991950e98f6 100644 > --- a/include/asm-generic/tlb.h > +++ b/include/asm-generic/tlb.h > @@ -209,9 +209,9 @@ struct mmu_table_batch { > ((PAGE_SIZE - sizeof(struct mmu_table_batch)) / sizeof(void *)) > > #ifndef __HAVE_ARCH_TLB_REMOVE_TABLE > -static inline void __tlb_remove_table(void *_table) > +static inline void __tlb_remove_table(void *table) > { > - struct ptdesc *ptdesc = (struct ptdesc *)_table; > + struct ptdesc *ptdesc = page_to_ptdesc(table); > > pagetable_dtor(ptdesc); > pagetable_free(ptdesc); > @@ -499,17 +499,6 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) > return tlb_remove_page_size(tlb, page, PAGE_SIZE); > } > > -static inline void tlb_remove_ptdesc(struct mmu_gather *tlb, void *pt) > -{ > - tlb_remove_table(tlb, pt); > -} > - > -/* Like tlb_remove_ptdesc, but for page-like page directories. */ > -static inline void tlb_remove_page_ptdesc(struct mmu_gather *tlb, struct ptdesc *pt) > -{ > - tlb_remove_page(tlb, ptdesc_page(pt)); > -} > - > static inline void tlb_change_page_size(struct mmu_gather *tlb, > unsigned int page_size) > {