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 0BF8BE77197 for ; Tue, 7 Jan 2025 14:17:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AAD36B0089; Tue, 7 Jan 2025 09:17:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 358AB6B00C1; Tue, 7 Jan 2025 09:17:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D4596B00C2; Tue, 7 Jan 2025 09:17:33 -0500 (EST) 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 EC8F16B0089 for ; Tue, 7 Jan 2025 09:17:32 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5180E1209DE for ; Tue, 7 Jan 2025 14:17:32 +0000 (UTC) X-FDA: 82980858744.03.D3CA321 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf21.hostedemail.com (Postfix) with ESMTP id 415E01C000C for ; Tue, 7 Jan 2025 14:17:30 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736259450; 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; bh=LdjW4ickP4Xi4e0fu3fIWfHzf6KJRYYvI9Few8GoUtc=; b=ReZ1vt0rAW/9+RJraUU6W4X5erWgrBNo56x9PTipd7CowlGLvfftgj+RLLX1Wu5j4Lk4qj vktv7+eCjSFRDAWaJcfd7o7CetVj7OLNcgsTndlQmnneinWdMAstQKDukVrZh5OfjXI9Dz zG1Y9cYWr1bevfhoxv/pyB/lMjjQAnY= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf21.hostedemail.com: domain of kevin.brodsky@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=kevin.brodsky@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736259450; a=rsa-sha256; cv=none; b=TfnlV8txiegRLKGV4jwYaWw7aFI9BNYkOf2Puo4CfiLjhCDlHywNwWCzZXQ8iXHDTJEBXm DLXDwiC/HDFCFL54VmhTwjWhFbIaGvurfrD/a1BOVOohcMpe0pP7E2ujazZP9xhTdQJKdj pAM/ViN1d/wQ3vlHJxL6Anq3VxuB2eo= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5F4761424; Tue, 7 Jan 2025 06:17:57 -0800 (PST) Received: from [10.44.160.93] (e126510-lin.lund.arm.com [10.44.160.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 91DCA3F59E; Tue, 7 Jan 2025 06:17:20 -0800 (PST) Message-ID: Date: Tue, 7 Jan 2025 15:17:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 10/15] riscv: pgtable: move pagetable_dtor() to __tlb_remove_table() To: Qi Zheng Cc: agordeev@linux.ibm.com, palmer@dabbelt.com, 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, rientjes@google.com, vishal.moola@gmail.com, arnd@arndb.de, will@kernel.org, aneesh.kumar@kernel.org, npiggin@gmail.com, dave.hansen@linux.intel.com, rppt@kernel.org, ryan.roberts@arm.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, peterz@infradead.org, akpm@linux-foundation.org References: <0e8f0b3835c15e99145e0006ac1020ae45a2b166.1735549103.git.zhengqi.arch@bytedance.com> <1b09335c-f0b6-4ccb-9800-5fb22f7e8083@arm.com> <7e2c26c8-f5df-4833-a93f-3409b00b58fd@arm.com> <31e1a033-00a7-4953-81e7-0caedd0227a9@bytedance.com> <07e0c05f-cb69-4263-885d-6d20d4442152@bytedance.com> <4a0b5edb-6fc7-4df4-93d9-ca834e6a760b@arm.com> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 415E01C000C X-Stat-Signature: 4ebtdex79q86djq8pr45ky5e1mfqsbua X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736259450-19664 X-HE-Meta: U2FsdGVkX1/AJIst5SNtwBs5NvBftduCEHhh5HOKCMLSqS6tqldbcc6biMLKAdfURRjfa/+jd4GPHtXP7yjPexFuLEw7EsA3XThqEu93XaRL9sX4uh+ltbng++D6Z/EBPGtH1lqaZNj0aNcThEaUlEwQNRtveOR6NMFNiNRh1691KriIiFhlEfIfs1EIqd9f73b00gQV57f20JXRVNNbrgCvFJF7GN+1tDTM+EARZj6h8h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ofilter, 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: On 07/01/2025 13:31, Qi Zheng wrote: > On 2025/1/7 19:58, Kevin Brodsky wrote: >> On 07/01/2025 11:51, Qi Zheng wrote: >>> [...] >>> >>> Author: Qi Zheng >>> Date:   Fri Dec 13 17:13:48 2024 +0800 >>> >>>      mm: pgtable: completely move pagetable_dtor() to generic >>> tlb_remove_table() >>> >>>      For the generic tlb_remove_table(), it is implemented in the >>> following two >>>      forms: >>> >>>      1) CONFIG_MMU_GATHER_TABLE_FREE is enabled >>> >>>      tlb_remove_table >>>      --> generic __tlb_remove_table() >>> >>>      2) CONFIG_MMU_GATHER_TABLE_FREE is disabled >>> >>>      tlb_remove_table >>>      --> tlb_remove_page >>> >>>      For case 1), the pagetable_dtor() has already been moved to >>> generic >>>      __tlb_remove_table(). >>> >>>      For case 2), now only arm will call >>> tlb_remove_table()/tlb_remove_ptdesc() >>>      when CONFIG_MMU_GATHER_TABLE_FREE is disabled. Let's move >>> pagetable_dtor() >>>      completely to generic tlb_remove_table(), so that the >>> architectures can >>>      follow more easily. >>> >>>      Signed-off-by: Qi Zheng > > I missed your Suggested-by, will add it in v5. Ah yes thanks! > >>> >>> diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h >>> index b8eebdb598631..ea4fbe7b17f6f 100644 >>> --- a/arch/arm/include/asm/tlb.h >>> +++ b/arch/arm/include/asm/tlb.h >>> @@ -34,10 +34,6 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t >>> pte, unsigned long addr) >>>   { >>>          struct ptdesc *ptdesc = page_ptdesc(pte); >>> >>> -#ifndef CONFIG_MMU_GATHER_TABLE_FREE >>> -       pagetable_dtor(ptdesc); >>> -#endif >> >> I guess this hunk will disappear since this call isn't present to start >> with. > > Yes, I plan to add this in the patch #8, and remove it in this patch. Right I guess this is required to keep patch 8 self-contained, makes sense. > >> >>> - >>>   #ifndef CONFIG_ARM_LPAE >>>          /* >>>           * With the classic ARM MMU, a pte page has two >>> corresponding pmd >>> diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h >>> index 69de47c7ef3c5..53ae7748f555b 100644 >>> --- a/include/asm-generic/tlb.h >>> +++ b/include/asm-generic/tlb.h >>> @@ -220,14 +220,20 @@ static inline void __tlb_remove_table(void >>> *table) >>> >>>   extern void tlb_remove_table(struct mmu_gather *tlb, void *table); >>> >>> -#else /* !CONFIG_MMU_GATHER_HAVE_TABLE_FREE */ >>> +#else /* !CONFIG_MMU_GATHER_TABLE_FREE */ >> >> Good catch! >> >>> >>> +static inline void tlb_remove_page(struct mmu_gather *tlb, struct >>> page *page); >> >> Nit: might be better to move the declaration up, e.g. above #ifdef >> CONFIG_MMU_GATHER_TABLE_FREE. > > Now only the tlb_remove_table() below calls it, maybe it's better to > keep the impact to minimum? I feel it might be better to make the declaration unconditional, but this is really a detail, I don't mind either way. > >> >>>   /* >>>    * Without MMU_GATHER_TABLE_FREE the architecture is assumed to have >>> page based >>>    * page directories and we can use the normal page batching to free >>> them. >>>    */ >>> -#define tlb_remove_table(tlb, page) tlb_remove_page((tlb), (page)) >>> +static inline void tlb_remove_table(struct mmu_gather *tlb, void >>> *table) >>> +{ >>> +       struct page *page = (struct page *)table; >>> >>> +       pagetable_dtor(page_ptdesc(page)); >>> +       tlb_remove_page(tlb, page); >>> +} >>>   #endif /* CONFIG_MMU_GATHER_TABLE_FREE */ >>> >>>   #ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE >> >> Looks good to me otherwise. > > I will add your Reviewed-by to all patches (except yours) in v5, can > I also add it to this new added patch? (if we agree with the discussion > above) ;) Yes please do, thanks! - Kevin