From patchwork Wed Dec 18 13:04:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13913623 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 4B838E77187 for ; Wed, 18 Dec 2024 13:06:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3DF36B00A5; Wed, 18 Dec 2024 08:06:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEEC16B00A6; Wed, 18 Dec 2024 08:06:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B696B6B00A7; Wed, 18 Dec 2024 08:06:34 -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 952506B00A5 for ; Wed, 18 Dec 2024 08:06:34 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 46E97A0E23 for ; Wed, 18 Dec 2024 13:06:34 +0000 (UTC) X-FDA: 82908102984.12.BC34BEF Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf16.hostedemail.com (Postfix) with ESMTP id D4649180017 for ; Wed, 18 Dec 2024 13:05:59 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hopCTN7E; spf=pass (imf16.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.179 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=1734527171; 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=VAJKsDdGNb+ALwQvMYs9Oz9Vq8VGrLJsA8GxB+kZmZc=; b=NRXUSpAUc3BUCzvix549ou7fUMZEFghU7u57+NCiQatZbm7EhrMvjhu1s2TTSb8grSUcEi 33vkvsg+9JORG87K7BfhsdaZUIJ77iv+UUqsE9T64rjph8G3R0f3pMTw/UW/tTZxA5XW7N A+lj5Y6I0bSC5ERyPW7kYnRA9uKWrac= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734527171; a=rsa-sha256; cv=none; b=cM6P+9q2vbdco+KBtz3zWvmdKo51QiLX0ebut7ZrGWEdTgasxTTpe7EjtpaNaH0bq7HJaP K4orTIPUri/j7TA8zivJ3hTQbuNS0FwFfR54+Zv3C7oizFe51p4l4FG1DFjSHFfwgKslw5 rgGuuv3t612tNuAdPosWFnmY2euyJTA= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=hopCTN7E; spf=pass (imf16.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.179 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-21634338cfdso77582775ad.2 for ; Wed, 18 Dec 2024 05:06:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734527191; x=1735131991; 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=VAJKsDdGNb+ALwQvMYs9Oz9Vq8VGrLJsA8GxB+kZmZc=; b=hopCTN7EbW3XOHt4nZN9y2u+kAJuhJfYlg50MGYQXqZxAf+qpGq8+aO5bHmT4Gxlbw 6kG6hIhb5UFmQP3osy28w7gMagb+90DI7hrZAijrc5V25vnHr1kgaEQv7XMJUwp/4Eon 5pG4wokWdU2LV080z7Lc5EtpiYR5/D1ZTn1KMHmPavl5VvWbdDtigEdGzgV07B/mn0oh Eps5XOEVCHcTICz/6nhULC4cnSZxTfABXhYhuTf6tiGsiV/8xthzOc6x/KG6QfsOj4K9 0hAnfeBVGKd9M4iXVH1k2nNrTzvGIe+0wdio6DaD/4Vp8gmL7NqWMZPqer/S87u7PvLM Wc7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734527191; x=1735131991; 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=VAJKsDdGNb+ALwQvMYs9Oz9Vq8VGrLJsA8GxB+kZmZc=; b=qX/6HFsxr+n+tjtakoi2owHUK0Ko1tOAvV6Tbe3o6ddTaIzRD90h2au5C5xGLXMeia dIQAjdv1t4g2UcAX7NJ5KzyKhVeeMB6oZp/SVtAzbtSWaH8ZlZbD+d35VuBn4Wh34MK3 yWO7yig7cKHUPtIc3IiwDy4JRy/JTjJBZC1MGj4VohIvtAOL4WAebYQBlB9SEdexTZin 36wQiEgRTUUojdUrDMVAHHUjWk2isl1EUm2EFTgK3WODYAzQ6/RI/tPchGqhldtnZ0iK Z6s3z/CsIcV3rlWk2Z+h7yCRjJNs6SMeGhygcAtVxAF6tmPsbliRnlUlmctQXZLAI45L YPWg== X-Gm-Message-State: AOJu0YxN42dF3ykXnP4dVWTHqnR+6bVluxHUUrS59Z3bhU9nrCiuQJ7h e7RlZjp0JzJtEShcyjEy6gvuigt5ZLfZ8UioqhyC15b1mHv4NaMoyyBI5wzyaaE= X-Gm-Gg: ASbGncv0kNo34TPLrVxlACWkdhi49hizkSi+tT1GEwMtC7c4ggUPPOlXBc1OawA/88l qWfUkMGqju3Ei9jT+/p7xmkKwGq9bKNMGTidqzXf8bjJ/bLlJfzsr5HwQybmp3DdFg+CauLuyA5 jPN8E07eXsF0bUHewpMPHAP5wm2W233yWWqdEQAFAFbFRDBJvdq1wXP8Pb0ZieeYZbl25sGKvqT JEPOgJiuFSoOw2lKmB8RJcBeZsBq6ll5YP5IrjEIn0Im1p0cxbPzMLsWhUWmV6XCMgL0GGGnHQw zUlfINarLJwUkOs7+Navhg== X-Google-Smtp-Source: AGHT+IF0te8v/jB1TE9z7MkQrDAS+cXnBWDMEESZdiy37OaR/n/IJPlBOW2ORibeoxTxN5xCd8QOLA== X-Received: by 2002:a17:902:fa4e:b0:216:3732:ade3 with SMTP id d9443c01a7336-218d7268fcfmr30133425ad.35.1734527191112; Wed, 18 Dec 2024 05:06:31 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1db755dsm75751825ad.42.2024.12.18.05.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 05:06:30 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, 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 Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH v2 12/15] mm: pgtable: move __tlb_remove_table_one() in x86 to generic file Date: Wed, 18 Dec 2024 21:04:48 +0800 Message-Id: <5129586354b398c26c80165dc9ebc7321ecd7a51.1734526570.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: rspam02 X-Rspamd-Queue-Id: D4649180017 X-Stat-Signature: qgktozroxi5s6ds9gtbg9ih7f7dhq955 X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IFtNOoiYpeCBvP5EPOPlbOa/pyw4LaUFtnpd9rRnHlMOJoTIdAikk6xU7R+NLrTQp/RTk7ORnWJ3P7VQVMkeRAmYIHpdTMlO9mrbZiXkTifJ/JKnxznZFj1nV3Dwp2wI6u1ve2Mkq0FOLTMLSgiHRi6vdc87EdH+IZ40j08vYF+2V5e00kRd/07GvQ28mM2XGn6ND0uFMD6kPqau+STENo9OqvEayLTz+igT3iLiKNTu3xU1BoE5+6/6/FDE+rXNgIaUG2zaOHKM21Ja5ekiQXSP/rNfHWYEE1hpfv0ZrdSB6deDjIX/RxwZL1n4Wx4dnaqI+glRH6D3Df0tUfuwSRZIqo9aKnlZt/8YfY7jypWtO4PHspIZyzrvIZBQOJ1sRWg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.026022, 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 --- 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) {