From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 6966433E7 for ; Fri, 22 May 2026 10:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779446902; cv=none; b=tLoHWzp90aFSdWYjUgvfWTWveQGz9vzafeXE/KeDPrINFqg4ZewA1R0et5RngkkEbnlM/g3dbfV9YW7yoi8kq7wvnBlfgxQmcxJSY1A5xcrUGMPvaMLZcQyq9p4e5+Q4bHi3m0aN5Kq7iDW9oHZG5rpbkTHttiacMlAKX6lfq5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779446902; c=relaxed/simple; bh=829XS1ArU5aBwQnruaXc3rtIREkuHiakdgDmVvlB2uw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aGyFH8v3Ln06pRSGmRPTnJHyy9YR1Veb7zFTRaBR7qTw/laeO76o+TA/yM9zdjmjtm5hwqn/Usv9UJwXRWw3kGuXF4d7g/7U/lbYAKA6qTk4J46LQC/j91Bnq9aavznF1axhYdvHH8ugDaEJQz94bt8SuDhoeBbZK9IQmfnWAmM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yzItRzqX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=z2oRKVJ9; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yzItRzqX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="z2oRKVJ9" Date: Fri, 22 May 2026 12:48:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779446899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m1oSdY8tkX7yIIMK2FNWW1IlaGZD2mRNFPvGvzzjU5w=; b=yzItRzqX9OpWGkI3qnt2k9Mg9++HtAgXZEEux08O4xBd235HI27VDncTFiSUkHaM7LWlVQ L+krhul/au73LAseeaKBC5e6qGZgwGks8ZpHqNbtH9pHSqEkDSLPn57iJtnjzVuf2pGC8V 1K4Ymayoa3I7gvJ2QcxWU3Q1Ms1KcoDjvuttqcG/ikYXsQwDi9by4b4ZBE3lEhJC7Ax2eF zVFeQvQ6HSeQ/ex1SwOUTuWah2cRHk/+LYVJPeoiPR4Vsy42GyvbhYRv91gjaQ7zO+kMni R16thlAvUDfsHI5fTX7uUWdVJlgDHTzUqZL/Hnt7sw9212I9C/raIl5IWC4Hag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779446899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m1oSdY8tkX7yIIMK2FNWW1IlaGZD2mRNFPvGvzzjU5w=; b=z2oRKVJ9LRt5OIPDPOc19YowbRYVxF6zequ48JMQGTEeLqWIHFkHOn6GBSSGqaY3cimufX a3UJH3hXtou7FODg== From: Sebastian Andrzej Siewior To: Chuyi Zhou Cc: tglx@linutronix.de, mingo@redhat.com, luto@kernel.org, peterz@infradead.org, paulmck@kernel.org, muchun.song@linux.dev, bp@alien8.de, dave.hansen@linux.intel.com, pbonzini@redhat.com, clrkwllms@kernel.org, rostedt@goodmis.org, nadav.amit@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH v5 12/12] x86/mm: Enable preemption during flush_tlb_kernel_range Message-ID: <20260522104818.CbT5fyN8@linutronix.de> References: <20260513124524.2569867-1-zhouchuyi@bytedance.com> <20260513124524.2569867-13-zhouchuyi@bytedance.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=utf-8 Content-Disposition: inline In-Reply-To: <20260513124524.2569867-13-zhouchuyi@bytedance.com> On 2026-05-13 20:45:24 [+0800], Chuyi Zhou wrote: > flush_tlb_kernel_range() is invoked when kernel memory mapping changes. > On x86 platforms without the INVLPGB feature enabled, we need to send IPIs > to every online CPU and synchronously wait for them to complete > do_kernel_range_flush(). This process can be time-consuming due to factors > such as a large number of CPUs or other issues (like interrupts being > disabled). flush_tlb_kernel_range() always disables preemption, this may > affect the scheduling latency of other tasks on the current CPU. > > Previous patch converted flush_tlb_info from per-cpu variable to on-stack > variable. Additionally, it's no longer necessary to explicitly disable > preemption before calling smp_call*() since they internally handles the > preemption logic. Now it's safe to enable preemption during > flush_tlb_kernel_range(). Additionally, in get_flush_tlb_info() use > raw_smp_processor_id() to avoid warnings from check_preemption_disabled(). This is a bit odd. That smp_processor_id() is there to catch users with enabled CPU migration. The only reason is the accounting done in flush_tlb_func(). This raw_smp_processor_id() is only needed in flush_tlb_kernel_range() which does not call flush_tlb_func(). This is only statistics. kernel_tlb_flush_all() does not need info at all. kernel_tlb_flush_range() needs only start and end. Oh well. > Signed-off-by: Chuyi Zhou Sebastian