From nobody Thu Dec 18 20:23:53 2025 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C829B1B0416 for ; Wed, 18 Dec 2024 13:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734527193; cv=none; b=QyQxPrgX7nrAKoZ4ovzwFpJZxg5KwoqEDDrndylfPsdqaIrG6alshjYWq60bwxq++vT8wITz3WbkOpJZFxBvXXbXcho1huuVjcdz23uYEO/nhXPSN5elrzTPeyEaU90rxBk7wLC1k8YaekEgZ6R30CDDunbrD3g19riOPM6XLwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734527193; c=relaxed/simple; bh=AOHzYz3e0W68bypaywk5PqwWiTbsh7X+wa84FHfFzTo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fim0k235BF18xmXG7QPX7X6+x0d8ceYbNwizIImCxBvjRSDfMPiOqoRolVXJYpb5ugLKe0P2J2D8BxVy2uRmllRU2wL8alKoGf+e+KKhIqyS1rk81xMLCdNfKeuxPGyfHRuMm1MWG8sXAvABpIlfP6EfHNTpGcJH/FqzMvDkjmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=hBXJ02Mq; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="hBXJ02Mq" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21644e6140cso60661735ad.1 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=vger.kernel.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=hBXJ02MqMcI1ZorEciAWUscQzffpHD+Yo3C0Kg9nWL8HG3Rvbo1H53SSArhR7Ku+YW mZSWnyy8CYi3Ibd9J65Io6iWsRMplQMuTjUzHIEzg/9Fq40YZBwxrLvOwSgTJ7BcynVx rOTgLZ3oTxMV53A2rZB/uHQFeYOGannAm2VY2zi0gBH6yFMUghVIJH5skh2f6WiDSiP5 uEUI+XTAZhUW4xxKDOkoyo+nCTYOTkXN0yCnF2Ickd4fC6mDvfcL9oAGzo3h6C4RSNyX LZ3IrqQU8R7RTzhhEvKpTGpj6ESQC06fG8nFNuLgdH1EBTTMNNYVakXTr/Cr8zizwoz0 m0Dg== 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=QQb9nBI64gMss8lC6sawFoH2Aae9Qz1STd/427FKeDoayP3RDFp7Egyfxs0uJZl0gS zMhAntxpdY03mv9hYrubEH+ge61Cw9Sm5G3JfpYFeQgtpCh2cDKMGYQshTnHMOipbcPb z4UpNEBDD0Qy6k3KdA8dZFLTX3sZ3yWX6skg8NvD90PvZWM24WViaetIQ0Qp42X4UfXy p/v0jXDUvn4CjVX4Uwgv+0gtaWb8U9wVBqb0b4CXpQ+xLvzx1PXTUdvRi7trGMPT/DrC DyDyokWRtV0u8DyBxPtySa2+z7PXP6Bd4hJ5hYEcJrB0IEe17X2zop0ZWYhRD2ikxPxL HZzA== X-Forwarded-Encrypted: i=1; AJvYcCVVs52JbeGhrQkuIAAv0FCwRnvEPTwvO7Ua2802OTpYLaHubtOUo2Q4oGPuNy0rE5q6YPmAIBKMt7oZ1kk=@vger.kernel.org X-Gm-Message-State: AOJu0Yyiib2AwN7rzbJdteX9fLPY9XKYSge41vpYvcAGY+Rf0xKqX+Y8 K6+BteC9paQxVb1youtK6bhxUnLB8DcHowDc+uMJs6B9G/z8fMesaFFYBq4w744= X-Gm-Gg: ASbGncsSYe1ogFIuqdXeoz5cl7f8oHHea/QeCN4DW3TL4UnjS2aXI5w5zJW4Za+xl0q N3dijSSQ9B2MyrWszK/NvF12kda7a5L0jq9q0mOlcsHMr+oDbpbRBo/PSUw/jHXA90QLGsvT2rl ca8zzJeFOxr/SA761ZFgWlFYwNbDyPINOyjTIaB/JwMLPalc5b+4GRQk1OB65TEzvg+OOVt5rvl NbGMkc80s2HiixhGDSyKEYjw2EP+NyCWWpRGEFclz9EaWLyz3M58WVtRIz3SRlfcsO5g8u2ZfR3 5UzBUS3kzolNubGcuexmew== 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: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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); } =20 -#ifdef CONFIG_PT_RECLAIM -static inline void __tlb_remove_table_one_rcu(struct rcu_head *head) -{ - struct ptdesc *ptdesc; - - ptdesc =3D 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 =3D 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_ga= ther *tlb) } } =20 -#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 =3D 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 =3D 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 */ =20 static void tlb_remove_table_one(void *table) { --=20 2.20.1