From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 3473918B482 for ; Sun, 22 Dec 2024 11:18:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734866337; cv=none; b=g+pZfQVPdEKS9YSO7ADeu9pStVJqfxHdpVWT0ACtP5+emAkhfPr3NnDHYjjPhiPkz8kMeIHBgPwkPS3o85V23O/h0PBJ56Gyw3TCOIMCE7WthRDz+zsPtZABDDZvND+sVVY7Xom63u/CyfBBiALY9RjNQ5qbARSONAW/jAL/pec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734866337; c=relaxed/simple; bh=WRipMdD0oozy9T2YmE0kfpLjEuTGKnFfsm5KrtXqD1g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ujFjg9zogSTFLFedI6sAumRxCgv9K0anFj0ufeJKig0yMa9S0AVDgIMnG8iqlwxB8fjrQKyW8C/8NZA95ygxNxwm0vgX3MfBn3pBx3XJb2SNO/dy0oCiGtVZTfD3GVr0oKv4tX6SxH2nZrQAM2DLvUkckuTpA3l6U8iDZ7RIjzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=cgvtc2Yh; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cgvtc2Yh" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=evlyFOA/JB7roBzKcduZH51jzwSedvndQnDISBPo/TA=; b=cgvtc2YhF6txf3Z8Zv459E+BAz gRxKB0Pgip9j/2ARCHiYJ/uXwYhSobjalRVYELrPSpEZk32Fr+lVZBlHzUP6+U+LFW0r5aKFnJXQa /Wd3JUQnSXI2GqJm/FT/91LUtV6dCuX8X/eP9So3WoVy/ZAdr56NV0VOmGC/oFCEeLO9FLe4ryTWB c/mZncJqruJ2d0w+GVH1vFmSrq9mPX+z8qDgd2Zdt2KSWsPRRogbtEtbdH53nbCfP1KQZReBVbZEN Af8mw6E9UxV1Xl3NJFyGRur/2R271o73sFxRYzQhlSTW8tHcy9fY7xEywJJUNN4Bj028F+/R4jwM1 ZosOOuhQ==; Received: from 77-249-17-89.cable.dynamic.v4.ziggo.nl ([77.249.17.89] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tPJyz-000000066ja-2yuB; Sun, 22 Dec 2024 11:18:50 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 505583003AF; Sun, 22 Dec 2024 12:18:49 +0100 (CET) Date: Sun, 22 Dec 2024 12:18:49 +0100 From: Peter Zijlstra To: Rik van Riel Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, dave.hansen@linux.intel.com, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, akpm@linux-foundation.org Subject: Re: [PATCH 06/10] x86,mm: use broadcast TLB flushing for page reclaim TLB flushing Message-ID: <20241222111849.GW11133@noisy.programming.kicks-ass.net> References: <20241222040717.3096835-1-riel@surriel.com> <20241222040717.3096835-7-riel@surriel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241222040717.3096835-7-riel@surriel.com> On Sat, Dec 21, 2024 at 11:06:38PM -0500, Rik van Riel wrote: > 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; > + } Urgh, move this before the get_cpu(), and write it like: if (static_cpu_has(X86_FEATURE_INVLPGB)) { guard(preempt)(); invlpgb_flush_all_nonglobals(); tlbsync(); return; } ? > + > 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 >