From patchwork Wed Jan 8 06:57:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13930206 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 A4B57E77199 for ; Wed, 8 Jan 2025 07:03:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DBC46B00AE; Wed, 8 Jan 2025 02:03:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3662F6B00AF; Wed, 8 Jan 2025 02:03:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DF036B00B0; Wed, 8 Jan 2025 02:03:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EC3016B00AE for ; Wed, 8 Jan 2025 02:03:12 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ACFC3120A7F for ; Wed, 8 Jan 2025 07:03:12 +0000 (UTC) X-FDA: 82983393024.14.C7FE02A Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf26.hostedemail.com (Postfix) with ESMTP id DA72714000A for ; Wed, 8 Jan 2025 07:03:10 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ZSy+53s0; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736319790; a=rsa-sha256; cv=none; b=t9HsTtQjuFisds1JtSbZSM5gcjnP95s8pZjz5gqfY2hwpQEBXlBXmRy0GoxRH0S71iMhiw imso5vDCF8Ebfv76c5635QHWxHW8fws6vw+Ejy1+2dHcWbvNUOOrKpfHtIdJ8EhhDNMXLa Hnt95naY8t2EP3F25u0J/AfeHIXecXo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=ZSy+53s0; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 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=1736319790; 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=SzpcYcAmR7wIjJMr9qjJ0ueu9TAADg8s+gPSbWL3su4=; b=Iw2SqCG/r05ByrwKP1XCk9PZQLKPLMQ7xlVaTJFGgvMtq0X+LLXEb3I9FSCIoGrBB5iImq yoBqUuvxMqiuBM03pIx2GJ/skjY2XCxXVdGRb6gnn0rp/y80OuJ2ALXn9gFNbk9r/L0JRc DXTBnyH8BgD1PYd26lJh8Ho6YFiHUdw= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-21634338cfdso29994685ad.2 for ; Tue, 07 Jan 2025 23:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1736319790; x=1736924590; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SzpcYcAmR7wIjJMr9qjJ0ueu9TAADg8s+gPSbWL3su4=; b=ZSy+53s0uxkUwFVHqblr491ASJ2hK4rq7JHQ8hRwkfY7R4expld1NoP96JcuMF69JQ QltYCD1ZTK3yjB4H6BWJQUQMZgyDXJYkJQq7GmyS+TcQiDjYS3hQd52lZp81j6XPe+KW OMNG5lguvz4WWRTwLZJJCoKNKAOEBWbed6PR8MvbX5hy6DI1a8QxEuAxYN1/cs3bjObd 2NSFNfy/9tuB2ztJ1HLlhq1xqKPB1GfVfvyxJ32F8B3++o4yxi/5NL1aws5vkjm38FBc 170rtCfoWBbvDPSG9fGsD1g9RB0h/mCrfFheN+D+28eWOFhevnu6B8kobcx41JZuC6oK dplA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736319790; x=1736924590; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SzpcYcAmR7wIjJMr9qjJ0ueu9TAADg8s+gPSbWL3su4=; b=T25enMEcnGcV9dQi7sBd2w/L02dGV1n97Eeh3xnxZgmT+zCiNRmCe1LhmN2dLnNiBM UjzBA5C7yJ3wCeLvZehwsPrwxLsLiX0tIO23Iw7S/aXz+8hUic2QivX4zD4ky12jtGs8 sBUJDFjwYUTleJPUObxr74r6nlAQ0maT6v/7icQ2lzJX5i9lBDFzh0dJK2RtoxzV5sZD flmDYwS08Ac9gAI0ylOuQxiOirttM3w37UsAV2VpLb22QBVLP1LwXfTBvsvxmmj+SXV2 PTAw32njXvdDmd3w96fYBcrU95Ylv9lbXBsFCd6HJbcAyZ3sdaj+TB86RbGiKtoXU2jO jSUw== X-Gm-Message-State: AOJu0YyeDwuwyvBTFuY+xjHMXFQ7346OXyosWnUqA5/T2jD9RQRNEq26 ifgCqWPo2/47jETD5VtVL9rSlwaPUd9DW3OD4NMRjRzEOyiCy22MzGNXtKZ5msI= X-Gm-Gg: ASbGncuIu45nnbvIr10nwOiBrDdh9Ux+XgnmzZgRBfED2bDhD9HWWNx/fb41efnloKs Y258fUhQkMyO7eRODRe2UY7iXAcWYYfa1as8BJpHX7pzEHhob1TlrOnT6tFIZdgxbq9F9C2xBgx zh6DgE1Rz4YNWKVuUkmXRgNfRtbYIMxujzpNkRzUFW9nvaiH+N75VFGO/VUSUt5CH0lEhpSa2vq ZzbJn8jLGbZLgV29qt3acPgM/W0zRb8QwZSzmapPzONAiihINN2VyicZMY3dIvtY6KBREnSIhVp FowyQc2EMrCUVkAM6sF7v0hrdHo= X-Google-Smtp-Source: AGHT+IGLH2wnugoAqXpKOjRMOcNm05e1d3DjACkQOqMsLyNNJS4LCZNqibWg6/9XtyaXTuj3byMh6A== X-Received: by 2002:a17:902:e74f:b0:216:7cde:523 with SMTP id d9443c01a7336-21a83f6710dmr31869555ad.32.1736319789694; Tue, 07 Jan 2025 23:03:09 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.244]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca023a3sm320067275ad.250.2025.01.07.23.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 23:03:09 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.com, alex@ghiti.fr, andreas@gaisler.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, akpm@linux-foundation.org, 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 Cc: 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, Qi Zheng Subject: [PATCH v5 15/17] mm: pgtable: completely move pagetable_dtor() to generic tlb_remove_table() Date: Wed, 8 Jan 2025 14:57:31 +0800 Message-Id: <0c733ac867b287ec08190676496d1decebf49da2.1736317725.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DA72714000A X-Stat-Signature: owpqr8r7ifuktyzqth9k11grgnes8uwt X-Rspam-User: X-HE-Tag: 1736319790-696590 X-HE-Meta: U2FsdGVkX188NQpnnUEUN8h4cCXdFUceSxLq4Whgz32jVPNJurrzBuTylqNKEWpTZYdLh3XnGF6FjdyBvlEAI1cMcj4i0iSltda9EtYwKk+Pbw/g8MJFCqHbbhn22t0KaFJ5E3HHio+Tej0baghC0HolNQH6XpanhpHAelX9EM+WzK2EFeWvqhnv6uGb1KV2FFlbJrJE28y9xFriEeG9F+HNSuis2lYGM3jLg1eLJh9NdplzmuST7Ho8WUtkcxerIOU2WIy/+QXiiWPhA4DYRaAzPtBQcdwOi8gf4++x4i5oBgd8Q2B4Em4jI5g1gjnP+3qgWzxU8QGuu7qUoM3sv/rvZyT+J7y6a395WgjhzrxmDUSw3Sw8vrZFM9IX7GreZNMZeT+fCQzw0KGxj4o+N/PeW0j327mJ+GKCJilWM+J+9xfzdt31XUjL4wv7CQobl8MSnD76r6/4/xXkyzuy7Tb6DMUuscWWan5tJupeAUC+L56xLr8VbaiE5pkBysADDkSWD6tcNPcUSlpivJX+YVaX4SI0+5ty+XKMvfZPAWKm3FUiF4o7yuRVFP8mlaLwOQAwJpUK34wTZ0tMU5C8KAIghKZbEZgHmyYHdQ0KZdHi11mLfZSaod3wwHtk6W/ge/yEdfo4PzrD7K3cVDOJqi14872WQ9Db8igFEAjEwC67GrgOVtebLl1xOLMJzElEzsTXUZYj+/jHqNSAD27EA0894QCxIilUTHsJ0S2H3iHt+CEmE6AZBT/dfVB9vs9V2RAyP/hRkHuTNeBz0SOamYPlMUS8RE8Q8Ov+GaixP3FyLwvyDvwZyl9AiSho+9kKfqY8pFu2jEe/20YyWdGCwkZctfxPjOtoyvZ+sHOKmqrvmtkoE6Npq5jklM5IR/f879kOGt8BozFGMbnLCf5j1ZjAVaPukCEoZrrN6VRiKuR/XSpo40T3ZAkqDrJ0UQa3UEh6OQmVuq0cqJzlIIl 69+L6f9Z QpVJQuZmZ5PxSIAVtn/erV3sSLxG4XzMDMIYSb8h3TbDzsnosI+rOiBEypUm5h6xDqh07/oz18y7cMjeupoUEKu8G8LbJSAceWQLdFRKDA+isYl7SYHwtV6ss5XFfCql5rpqA+kwcOulW7F93yziIwdINOXzkNHTaO2c7h1JEYybEGtOLdv7IRfEhOnsHj+Kxwr/jkASk3RgHdvfjSCHnVCmTmfqqs15vLdBDGjvy8lqdyN5zFlnSdpKA5VveWGqHp9THon4fCcEJtESYSuAdoh1eZUk9pP8y7poGiTW202oAI+13k4KI6sMGrrGnhc5KwtBQbTqht5WpKC7hOzn2VOHV/Q1lQZHLqSkjfEZ6VEFpNjT86COE/ncWcO3iRhP/Og1zpqbd8dHqKU1NMHZv27zgb+206YH3QamCZ1ATWS+C7JyiOIsbRsXJiXdvzmIeFBsEBrB/n7ptp5zCVCPAa98+Mv4Ur5+zkMNFy7opae0/9qw= 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: 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 Suggested-by: Kevin Brodsky Reviewed-by: Kevin Brodsky --- arch/arm/include/asm/tlb.h | 4 ---- include/asm-generic/tlb.h | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) 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 - #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 */ +static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page); /* * 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