From patchwork Mon Dec 23 09:41:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13918679 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 E249DE7718E for ; Mon, 23 Dec 2024 09:46:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 694AB6B00AB; Mon, 23 Dec 2024 04:46:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6457D6B00AC; Mon, 23 Dec 2024 04:46:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 50C086B00AD; Mon, 23 Dec 2024 04:46:05 -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 2F1CE6B00AB for ; Mon, 23 Dec 2024 04:46:05 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DD1501A1532 for ; Mon, 23 Dec 2024 09:46:04 +0000 (UTC) X-FDA: 82925741472.23.DEA2131 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf03.hostedemail.com (Postfix) with ESMTP id D8DD020004 for ; Mon, 23 Dec 2024 09:45:45 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QAuqMUNh; spf=pass (imf03.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.177 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=1734947145; 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=PU/F9WXmLQtMOL4qjE/djBfAGfMfwhWqWhJYMfBii/mZoVDHEh6VfOe2ouSTUZBunDl5r5 NlHG/AzxhbHnqVtwPssQdma3EcZ3TJrX5zcW3I6ZLxO/cIUdjKZtZ+am7CeXLIsZ8LghP6 M+VQJFDR13daD6YJkX3COMMk+MSIyrU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734947145; a=rsa-sha256; cv=none; b=kdiHxFdkyok5YwYRWpLdTGFfn3H+moS10zPIfq3Y5BxwWioXnD454PuvkXx/uUOF8FDLzH bK9E7NdR6cuJccgzk6L5P6S/EytwEFXUK5fPFUJVs4yZ+ppuHQ2d6t904yWm/XeBHyLoez QgWf8xkLMAdoW/HODdK3l5wKkj/8phg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QAuqMUNh; spf=pass (imf03.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-7fd581c2bf4so2341689a12.3 for ; Mon, 23 Dec 2024 01:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1734947162; x=1735551962; 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=QAuqMUNhGySltT09LXbUEasrpKS5CXBYDkZImn/LIOtWbdu5ZBsmyiMF/3Jx0YDhng 6D0Sa13QGgc00Wr23rb536lPFB3knuvYnWLWJ6g8xSgIN5rZFqI4uG/6OgI1w3LZ8iMA N1OTsBgLfpEzW1luXZyXHxxl9M+9HpZH/f4GtOZcM96O0q5DljK0iBBh6b3JDyAvIWeK 3xiY2R8AX+T9eZkS94GiILdSrrhNSnCMXsIuoAveS6C3Cc+bNP0Tv0bdJXPvvEilzpIT D1LyNfevBIcoVUkaWqmiFxE/9MiQu4Kc2MhxMN8Hs/xjmdY6KielkevtLMZflUIhioFW l39A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734947162; x=1735551962; 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=K3yMJpdv0rs5+k3iHlnzz1RJEA3S1VyEMQLLWXiV+knGq+EdDQMNdfOxAo32Ej4EZB qCW51bOY18HeGwtc+zjARY9w9tPs4msqSWlaWIZz0WrrmZOiMkaJ/azMgcL1WHtUk4Yf r4cMoFnU29Dn6QLTSe1a2ClQV6z/Kyxcl758/5Q8oMZ9btaYe1ClQWJ+f+xgy8VMr8Wf YtwnRpo5RjjvRk3JmDUdueckptDELI8bf1GuBLVhuJHt3YHmPNB14r/A3rLT0qkwidB0 GJcT+3B1tfCHQEPRBecOgUH4DaZNp2xq/UsWmvSwTLnlBjrx2k1J1I23w2bYAGl3YSwb N+NQ== X-Gm-Message-State: AOJu0YyC7lPCs5C4AX3bWrOg4pG7NFhYNmxlNn8DW8/c5TzVKlhkLIJO lQevQtaN1h35FlZ3MDVfzROMHUwjbDhQNvS2Rz/iuXEJLT5PUGPTew611TLIpx0= X-Gm-Gg: ASbGnctoKDPQjiw+Da7+y2GLTt4+OZGzvJg5sEtXueyIFs5ZohidqWO8tGcDTFRBF/A gunDp82MtwwwaAQB/kK7s6IGfUCwyIB3pxMZmtpAqNLJHJBRTC4zOD9sirCx7YJlwY0gUqDFTRW 41B5XYz/erzm9Q/xWLtjTmGYAfuve58ZcCRH396ig+3mHziBpUttjmdlqn+mWiSXQ/vY6fxMDCI vElOhXzrYPJF4HcBjeLBvHN9piKpFcPdiNDnwVONCZeO0Lhs2cLgFWXtfWon3ApS/8aif6ya1Dx p0DPc0/xhrl3ZEtNvLVyqg== X-Google-Smtp-Source: AGHT+IEiKQiNoCztX+vEmXJ78+SVJHcoRjQcReSYKDpgexw8hG6RQW+fGx0o5GN+OmUz8JwpFgmgkg== X-Received: by 2002:a05:6a20:c88f:b0:1d5:10d6:92b9 with SMTP id adf61e73a8af0-1e5e07f88demr18787949637.30.1734947161832; Mon, 23 Dec 2024 01:46:01 -0800 (PST) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8486c6sm7468309b3a.85.2024.12.23.01.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 01:46:01 -0800 (PST) From: Qi Zheng To: peterz@infradead.org, agordeev@linux.ibm.com, kevin.brodsky@arm.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 v3 14/17] mm: pgtable: move __tlb_remove_table_one() in x86 to generic file Date: Mon, 23 Dec 2024 17:41:00 +0800 Message-Id: <286e9777dd266dc610de20120fae453b84d3a868.1734945104.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: rspam10 X-Rspamd-Queue-Id: D8DD020004 X-Stat-Signature: f1frtzgfcupwoi99tmspq7j4odikinwz X-Rspam-User: X-HE-Tag: 1734947145-560866 X-HE-Meta: U2FsdGVkX180TbTQJamGJL0D+Z68RiDdcE7Zn/KNZliakVvv5mPTBysjYEVmQek2RqGxEGkenZX7ZKq5clD7U8nSuNSSYpjPMNSDvwbDRLD/0ke7r5HRs7zhI3+6EpGKI1BSZgnOe95s4gTnycAkEBSdPezg1Vg0d239Ul/pCnPp8CSi60uZ42iFzWKL77dpckb4BNwqh98G8Zk+DpRjt4f8RwzmU9g4MeMPcWvQ32OZRsHWSgDJLu5i06W/n0M7KhYN0F7PUmuBfZSZoEPMGmb3B2W9UhCH8U1+LaVw1ZeSJAdHCYeUdwZX4578GXNiQzsSSkGa8tJ+UK5rw6kxypr1Th0TsL8O0qBI/LKoviN57uUqQjUVhF+rWLAw1bOiHJatu8YacmavBej3DiJMNU19CUCPPqmfcFoBkWdZMaWbqBezjFE00ZmnmI1IRHlw79cebTr+TnzV2aKTluedHjM2ag1zL7NZzlJ+gKqBvIBe0dqnLTFSIbGkKMWVAJIdGcPry/K+c6KBnLCfPtRzbiJYlr7QyrIORwLH6p5yhOsR1Ztju67l97X0UUrTiGQS9ZYgXXabOtqzPNNZKn9bM8ZkSis3z64FMbBFeZaMukUX5CeC5yf2jXZshJBR2DhS9vxQLtzCPLRBtE1WrwI0NSHQSSqeGQcDL4Wx+jFPSQGi52pGlO6Bz4jaycPIefmIyB7oTYANN7U6IKalCsnyytVBN4m4BKztN/7GAQdfB2ko5nXFhf3F0vNTKQgn/I/wFw8nn4hO68mMrwByJyal6J9adSHmXQ62yZWyxkOQy4awfKdsAKOzOuO6JmH3UB4RHJAhPbA1T2XQ2udaGQN4NNrCrIqZQolyOBM6pbE8ypNkBoEmqlP9WfPbvJRWOdOBqLwXdWqmnvElAy6EXGPtauvpeUA10raDbzALFvBtq2Ducq8nb6FHhkCI86kLy4QK2ZD2QPpGpB3+o0OJpBy bB2TivdQ klCw5GjCo78zH5tlKEasmQvnR2eNNt8D4qvAGjpbnicgAydonpH9zSfAO00cV2uI8WwFw4eNUE06w+aP1uAoObJTNPq5uXacqz3vTOPkvwhL6AkrgJVk3kiGefrFnr6U850myxXVAsAaIq0Mw+RblfT0DD2Wxx3QGtPDGrQgxcte2bP4oZQuGuCJRKc4ba+BzevmTgqgdiBkUQW4oPfdrTzJN83rxJ70ldQb+6+L4QrkuSdCSx7T9ClRhrjA4Utkhow+9lwkgVqINIm9ksfSFTbwFjkpyq6PcX2MX2mTr7jti9XqKee5L2h91W4lBVFoX7AADpT68BuwAw9D3ZO7DMvPICRgg9xsW0Vka026spqgX4/kIgm8edl2MMTKAwrtRtHOs0fiNVgeFSPVF9l8Jb7fZADPESmBySPr9dybzghOE1HQ+3DPm7wt92g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.015531, 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) {