From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3F75136327 for ; Sun, 22 Dec 2024 04:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734840476; cv=none; b=WuD6Jf0q9Rd18K2szD5yEqF2PH9qsiR2GLpRbTOSovQqhTuZfSyUo36mWEI+PrG6oDfBUeMHi0GMKr+GCqTW9TIQaG8T38wPlW5v0qemIGw3ZLnuWq7tcb7jcTiA6hcT/U9Fbkb0KT66xof8F0cAgaUrntpu+6KrqOKhEL5qaWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734840476; c=relaxed/simple; bh=RQHWekjL6pDhpZeiqJiAZlnAUVrRWfI5d9sYYue7a/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nuk2s2Lejy+/hmiCCYxJXin8cVc5juy3tfFidPWy1F5rJBzglDuWuS2y2NEkbS7/JIPLwQ3zwWRTfPoOUwWVFwXWJchl85QxLNlS2tr3p7Rp9HKEsnLuSy2D74Eey5clAhSj0NchEncUiysQb0yh0ukAYnAQGgW50tCSU7qXZNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=shelob.surriel.com; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shelob.surriel.com Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1tPDFT-000000000V0-2jzr; Sat, 21 Dec 2024 23:07:23 -0500 From: Rik van Riel To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, akpm@linux-foundation.org, Rik van Riel Subject: [PATCH 06/10] x86,mm: use broadcast TLB flushing for page reclaim TLB flushing Date: Sat, 21 Dec 2024 23:06:38 -0500 Message-ID: <20241222040717.3096835-7-riel@surriel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241222040717.3096835-1-riel@surriel.com> References: <20241222040717.3096835-1-riel@surriel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: riel@surriel.com In the page reclaim code, we only track the CPU(s) where the TLB needs to be flushed, rather than all the individual mappings that may be getting invalidated. Use broadcast TLB flushing when that is available. Signed-off-by: Rik van Riel --- arch/x86/mm/tlb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index bf85cd0590d5..9422b10edec1 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -1313,6 +1313,12 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) int cpu = get_cpu(); + if (static_cpu_has(X86_FEATURE_INVLPGB)) { + invlpgb_flush_all_nonglobals(); + tlbsync(); + goto out_put_cpu; + } + info = get_flush_tlb_info(NULL, 0, TLB_FLUSH_ALL, 0, false, TLB_GENERATION_INVALID); /* @@ -1332,6 +1338,7 @@ void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) cpumask_clear(&batch->cpumask); put_flush_tlb_info(); +out_put_cpu: put_cpu(); } -- 2.47.1