From patchwork Wed Jan 8 06:57:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13930207 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 87066E77188 for ; Wed, 8 Jan 2025 07:03:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B9726B00B0; Wed, 8 Jan 2025 02:03:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 142F76B00B1; Wed, 8 Jan 2025 02:03:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED7326B00B2; Wed, 8 Jan 2025 02:03:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CCAC26B00B0 for ; Wed, 8 Jan 2025 02:03:27 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 797EF160953 for ; Wed, 8 Jan 2025 07:03:27 +0000 (UTC) X-FDA: 82983393654.05.D6853D2 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf26.hostedemail.com (Postfix) with ESMTP id A383F14000E for ; Wed, 8 Jan 2025 07:03:25 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QdKucnse; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736319805; 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=x40aCfPUIT+7f+SOGlgpQ1mZ5+3GERu3xGzgSvQpPds=; b=1eRr9z/N8ZDHQfyEqamExaZz4rHWFl7w6qjQAlQgOdxDKMXTBMMtKeDq61WXEIOyFnoBFt T6d2NdGfaomHLgh+9+rkfgCBfrMvVi+JzxNBbQrEhvHnWyXWwLl+Nn5m/CSXjA3K/camNV VSvodnXOPSNfEpZiCtqKSXMazV9rPDg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736319805; a=rsa-sha256; cv=none; b=X84zHJ2zwdPpJ4+z0WH3NqMkEPVdYLr2ZVKTaU00UHdHpN1oHN9PTPOYl3Y4Cgz9apdaPb i4A+g209jkIDq5uxaWAJekuxPDH9oPKgUVKz874NxahD6oPbXSOhPwE9ZXnhdOj0mQ/UXR u8Pb04OvtLWHg+lfpmtZQQTu1UhMUpI= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QdKucnse; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-21628b3fe7dso235497315ad.3 for ; Tue, 07 Jan 2025 23:03:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1736319804; x=1736924604; 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=x40aCfPUIT+7f+SOGlgpQ1mZ5+3GERu3xGzgSvQpPds=; b=QdKucnselaOe4Q7uU6l0wWKJw2p2Wyst1Y3yiEvpF8VSmI0sWDWJSW9l3J1r1SKI49 caArw6SArPiZpTI9PJC72T6ZL4Q8WaUhBiNighwzAiVmD8MnVXzxBeMTo8Hjmga6RBHG ffSxGpTVLtOa7VbQiwFN2LwmZRwWzEX9eMI0PxLwsGTxCikOMXGnVPEpzjlgngU1tryp sr/m5RWNSbMCXwk73K3Xh+4nRR/V583muOXTUzdjvab1G0jEgEB8Ugcg8bQSQkP1XV1q FNIcYjRxsEtVao8oH3+brgQkEVZFd36sFbZNbNTSSBK4sv1yVJeawD9Cz2AA+266YO40 w9Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736319804; x=1736924604; 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=x40aCfPUIT+7f+SOGlgpQ1mZ5+3GERu3xGzgSvQpPds=; b=bWRNhySCCr8iOSFEhfw9mgpomQDf2/W1za4gsX31CRCDDOoy3IN7c+lUXbnZhIvgnd vT3d0wSj5W8tqvM9XWd67XfRuucvErmL1sA6arRiUttIAyfj8w6W/EFirYuGUi82lS3B 0FEs5yriOOe11EmeyIQctcbpSPeok1ZhgAFlc6tBOOADMWAlG7+AYkHpWpGCiPrUf0BP vcEVCLY0VaNO2jLHwt5qfbBXNUamjU4/O+dd9FVxD0CAhZQ4teUNJPgp7bEQpP2zcQZX 3kGdEkNz5G5hKwbWky6Q412mJD9trfxdtiU/OTjd5qpj5DFlnANdGhBKrX7y9cm/5S05 WkgQ== X-Gm-Message-State: AOJu0YxCJFkeGhA6wPRO+5/b40dpvwuriO3pqUISarm33Div4EKkNelL f6orbMaebKRe3aQUcrVtONPLNtHrHhG3+cQZ8Oy2ppvMz6k+7rRwMtUtf3Wr7uQ= X-Gm-Gg: ASbGnctf4RHq8LV0NvOmoUiHFQpz0T/yJN7UtukDV3jjCyAr2kAuNwviH0jJWt4o7Bf RCjE5E3Q9muw+NRzZmHa1abjAd+YCSWoPh4ROvHlN2BJe/lPxtEim+03jSoLDUCOsSTx1tSiG0G gYFbqhXhehA1iwYgEXD7zMgi/MomblB9i8r6tsbf0d8ftcJRkh/Dh249VsdILdj2Xt0gfXnzYrX l2KLVXieOjjk7RwR9KpQDsOLW8X40h4o26IXMzqSWz6eSpQoKg4P/vmprSU9eGEV8YS+Dr2MihK GnfF7ZCSwah8ub9jdnbKxLGCcRI= X-Google-Smtp-Source: AGHT+IH8IKObAIjKqBGW3XQDBdiOawtDgYf1Tuj1urKOF9Kp4Be/TSELj5l2Ma8a+iBaK6i0ld/PMQ== X-Received: by 2002:a17:902:da8e:b0:216:410d:4c67 with SMTP id d9443c01a7336-21a83fb1395mr28350885ad.41.1736319804422; Tue, 07 Jan 2025 23:03:24 -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.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 23:03:23 -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 16/17] mm: pgtable: move __tlb_remove_table_one() in x86 to generic file Date: Wed, 8 Jan 2025 14:57:32 +0800 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A383F14000E X-Stat-Signature: 55d37kichpi8tgpwzkhgj4odrzbojhg8 X-Rspam-User: X-HE-Tag: 1736319805-906218 X-HE-Meta: U2FsdGVkX18S+hLHIj7Lo+HThrDkQNN8U0sr2AfbcoCfBifsIN+vS0SggTc4ShionuarGGl5hYoVZF2lljp3QQudvtcV4VL4ic0sycpp8BqBKBUc+3f3HCwm8Y5Jv8TF2gjgDdKoJzM5PG6ZNe+UOiTQlELwdCB6IMkbqg+aOQW5i3ksLXrry514g0kUXKG8PuoXZpzlwCZ669XSSOHer+X+hYKunyp4gwes9TOMQNj1YCYdybAekfFJbWiWOkgPQPAwmtR+54ZBTCKgpSew8CUTwbca4unHI5vHaqnuBRnSWjRyV6myk+DPz6vLhFCKkJgL/3hFgzBg2DM8VSVp0QWR0hsDerrqAx/YhucfM11enheatwRvyROV+oemv2srOxFDZygrS6jL2uIqLiGdZuVbzn7RBGgXupw9tSE7Uzn8n2RNRPUgPTu/aPpLwt7oaexE9ek5yNFqhAD69QT+FU4ReFlwii0lsDJJYby38G2Y1ivvb8L5bOvh2gxUcBWp1tZiqq3DCC9D93GUMO6pcfKfZLGtt2lNtWsdngqZCLKf2P8TJFz3lm5si0LHFS0HN1MsuxJZNLaceM+ZPZJT/BTWC1h9n6U/J1/LqzxzH0mlKKjmokOqA+HbVM8fsABMuWGPixI9fufvc8aJ5aAhE7RFmQWsxBwgmNSbemzPdMpaw067bsdSZgBEqGs9ben9ARDfhRglLl8XTLGO/eIokn9h3q75MC5U1DKjuTJSQ3OFrrxXL4Dsvd4nt9r5AMtltUYxMlFFhLEK7QjKbncAFYk2sau0MTcrcs5RriFdkaV7YX6xZO6TXfu6p6v7Vph3jlLGjK6H+5MyM64hFG5qhBayyDFVg/XW33GdF4titPtXsgOTIVdKLr3JGBpd0w00AR3SSURVwPdlge0n+2+ctD9BKCytsnfotKBGqduFBUBuxvX2SstsZa90Icea7WXM1Z/HsqtF0H4z6q0wWHs JlBhrUmg 2YDxvP3ubk5hibWcMxi+sROsJrZL6pFhIddbAjPwA8hnze1HMenkJ+gbm1FGB65cU6Wecmeq9D0m4Lrhjz3ggp40OjCJKw0w9Ttci+vYM9ZIlykpVnYqTWemxaYRkRpSLLuYKO+Iqqvoy/8Vn8ZUGLXR9RanTM8DIVmdcz4W/4WW5AfImqMU4R08clvaqru/gvv540LlrDlzEPMth1jUR6aap3Q/ChvMWyyKfAAoTwD9bvNrA3Vj3k5Ku7qkHNCgdPnMj8eY/s7ihyiHhuBCpvW0b2NwqeRf3vPlzN0Vj625yKHRLx3nE5gfeyvqJgtDRyH8b2A8j7tucpFkYcchrojJauz8qL7iWKmchVx5V61UfPKk6mlh1HnCW0RoxgmE/0XfsIqHwojwdApQ8FXimufYb4XkgJ1Dy/YzaV4q29T8acGH9SRcS9twFyAQak4j5Zk8aOpouik25DlXod6uo2QhL28sPmkyzEMgU7qEQEwAdOsA= 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: The __tlb_remove_table_one() in x86 does not contain architecture-specific content, so move it to the generic file. Signed-off-by: Qi Zheng Reviewed-by: Kevin Brodsky --- arch/x86/include/asm/tlb.h | 19 ------------------- mm/mmu_gather.c | 20 ++++++++++++++++++-- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h index 3858dbf75880e..77f52bc1578a7 100644 --- a/arch/x86/include/asm/tlb.h +++ b/arch/x86/include/asm/tlb.h @@ -20,25 +20,6 @@ static inline void tlb_flush(struct mmu_gather *tlb) flush_tlb_mm_range(tlb->mm, start, end, stride_shift, tlb->freed_tables); } -#ifdef CONFIG_PT_RECLAIM -static inline void __tlb_remove_table_one_rcu(struct rcu_head *head) -{ - struct ptdesc *ptdesc; - - ptdesc = container_of(head, struct ptdesc, pt_rcu_head); - __tlb_remove_table(ptdesc); -} - -static inline void __tlb_remove_table_one(void *table) -{ - struct ptdesc *ptdesc; - - ptdesc = table; - call_rcu(&ptdesc->pt_rcu_head, __tlb_remove_table_one_rcu); -} -#define __tlb_remove_table_one __tlb_remove_table_one -#endif /* CONFIG_PT_RECLAIM */ - static inline void invlpg(unsigned long addr) { asm volatile("invlpg (%0)" ::"r" (addr) : "memory"); diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c index 1e21022bcf339..7aa6f18c500b2 100644 --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -311,13 +311,29 @@ static inline void tlb_table_invalidate(struct mmu_gather *tlb) } } -#ifndef __tlb_remove_table_one +#ifdef CONFIG_PT_RECLAIM +static inline void __tlb_remove_table_one_rcu(struct rcu_head *head) +{ + struct ptdesc *ptdesc; + + ptdesc = container_of(head, struct ptdesc, pt_rcu_head); + __tlb_remove_table(ptdesc); +} + +static inline void __tlb_remove_table_one(void *table) +{ + struct ptdesc *ptdesc; + + ptdesc = table; + call_rcu(&ptdesc->pt_rcu_head, __tlb_remove_table_one_rcu); +} +#else static inline void __tlb_remove_table_one(void *table) { tlb_remove_table_sync_one(); __tlb_remove_table(table); } -#endif +#endif /* CONFIG_PT_RECLAIM */ static void tlb_remove_table_one(void *table) {