From patchwork Sat Dec 14 09:02:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13908437 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 0C09AE77180 for ; Sat, 14 Dec 2024 09:05:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A2786B00A6; Sat, 14 Dec 2024 04:05:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 850EC6B00A7; Sat, 14 Dec 2024 04:05:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CB006B00A8; Sat, 14 Dec 2024 04:05:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4A7E06B00A6 for ; Sat, 14 Dec 2024 04:05:31 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B571E42921 for ; Sat, 14 Dec 2024 09:05:30 +0000 (UTC) X-FDA: 82892980464.22.0B53955 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf28.hostedemail.com (Postfix) with ESMTP id ED17FC0009 for ; Sat, 14 Dec 2024 09:04:58 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=gRH3IFyi; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.169 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=1734167111; 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=Vsk9S+xtGChOliqDoLnSkhLADA01uASwm4V6kTdHJADgeP2fqVwQjDwV2yKJAgPEEVwiSY bXW2/GxGQp5q7z4NBKuir6DRNCOHELE502Rbx5GtkFyUSuWp4Hx8D/ZxnpvS581aLJT9SH /ofPCu5YLmB0Aoh4uVmEF24pOtkimws= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734167111; a=rsa-sha256; cv=none; b=oCeaBOfPXkkntCZW3G9WNYIj5lSvUWDxF/CfaKCq/Mc7hknPxEm7ALdn1pSraUWnGU+PRL SaCFBOjUHt7tlBpXi3RnS2Tns32pIJnaRbwqZv63Z0NHmLgzBztB8vPpQl7jWxHmPgJVf0 Y7BWdEyQF0dJS2h8vbbLA1ZQJek6wkY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=gRH3IFyi; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-728f1e66418so2185629b3a.2 for ; Sat, 14 Dec 2024 01:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734167128; x=1734771928; 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=gRH3IFyiM9JRze8fmJbQDcFb+hLkcWBdVUrw7m6XIZ5YiwJgzbEs+PaYgxkuW1Grjj W+E26gUhX0tMI5pjGrPOHrLk/BrOOMc0+JSqoRKeWwdy+mpo7wuotYm7hAIZ0Xp9kd+2 PhZINBHQWgHK9e5H5eDjxemxfekRwgLtTaPnn6lAwucFOhA8wjE2zEVB4vDZkT1a3Yf2 9DraEY0mHFlMuBKTn1jIHirClPHDWzTI2bpNz62wyMZJGFYuU6G2EfcXMGN64h35DRIu wv8VZ8n0asJCY+AGIlZN9e7Un5ODhev+paiAUvI1FCpGOZs78d1A5pO2MDMf0Nggeaoj HF5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734167128; x=1734771928; 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=ZLOKqfEZRaGk42Z4UBAGDDiVRGhq2DQAWQ6AKhOLjKdA9GGxJvgN7s7e4GA5R7TaoH jWs5t57q4puHAbccAcsSHwXi6F5t4Vb5XdL06J4YbPbAqKAMkB9aR1SHpicPAGG0bP3M px2S698gZva17gFXZ/Bmca7p9pF5Ii4UzFy6yS+i8An5UNY/jeDOc+3p/JbkbGU5jWtD /oxK3lPFrS8wfs+dRgUno84rV2gqhXtEZk6mIlCYsJGWUqGnvMO63X/4cQCxqUEpr1rh zjM/3xOUvpARJ2RThF4JLa9S4VW0S/ghl1bSM38QupIwnLYzJLv4Zy+eS0sDYR2uCzwk F/yw== X-Gm-Message-State: AOJu0YwQpKvOjJv3+TT7z8HqJ005YJ8rZ9w/QM0ak708ujWCC4LeCIN1 1MZ00uJVg2xfOvukQhc9ZZg9jDO2POvz7qKk9i6lagg9TzfqMDZMoaBdQ87VmZM= X-Gm-Gg: ASbGnctrMUvaSMpw078GxqP9H1p7G9/tbxSOAmDHcn8lwnWNMFWfmhXdbGq/F6lS0Hb Gs2uOl5itYGTdQfiIOMv76XPOqRLiNaFzhdn10F/aMlENeqI2mA6wub5UZb4yJdSNYaKEF7PlpY RMcu3i+YGyDacmV4JpbgFQ9k1exCybNbzZ5f6u7DFqcDkF5yKdWF/SELOzgy26kBmNeSKF6e2Gm XQivRTXZJeSaY3Qq3VcQJ1UhUhFrIp3kojPUg17JdarijGe4mOFcmPOirftvwqaL7rib4ZSv0LF 3zU8Bhb2LmtQCLGbRubbvQGYTCrf+Q== X-Google-Smtp-Source: AGHT+IFivM0byq9BUMDoda6VIidtD6lpjalZ4ywP7t2KopoDAAS1RcnNTtREGYaK+hQvD7u6okSdbQ== X-Received: by 2002:a05:6a20:1588:b0:1db:e536:158e with SMTP id adf61e73a8af0-1e1dfd91a2emr6805131637.22.1734167127753; Sat, 14 Dec 2024 01:05:27 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([2409:8a28:f4f:a9a4:5d46:4ef0:daa9:1db8]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-801d5a90ba0sm905731a12.16.2024.12.14.01.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Dec 2024 01:05:26 -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 Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng Subject: [PATCH 12/12] mm: pgtable: move __tlb_remove_table_one() in x86 to generic file Date: Sat, 14 Dec 2024 17:02:58 +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: ED17FC0009 X-Stat-Signature: cgahbdcmp5oiqfmhwxiaqqoesyqnt338 X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u5E4jH6MS41JUJ8oLRz8JRLgypufnbo2nWGevac+mcAKURDVcWg25b/hVSpqtAcUSujAjGgyiFvL6BJRpvSrHgHcEQBYhwxDPVYlDrDt3LpU9ZDcysnpE7odXX4saGeUbluUYDLq5VW3g9BM/VHjeyJ5WCRMs6/2XPAK+5NF11L2+2zS4xVQcmiMlJB6HP4thbo5YAeqhm/7bppGciqZ68RKI+bmhgwA7P6bNbMv5wIRqKv5O/GuAJrXKYm1TdeRSj6bGxGhQGsiogurZDg/J9DjgB4mpw2JkA+vv+ljxu79/9UXjD+f5GNBrtOHJhRYUgLiYhGBeLw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.005605, 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) {