From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 531A93314A4 for ; Thu, 5 Feb 2026 09:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770284674; cv=none; b=WSHOO9mrtHyMTvVjFB8Yp+dQvU9fEcIxDALjWnSqQ+ljnDKv4pi9474YzEpRefLluOC8NnCpAn516v1xE8OVlNayhOPWvxma3ssTzZCODDv5eui0Gy/fqAMrj6piNLzeBYKByViUBEQIdft4BSyg27GZ3SVyzOUYlb0PXEeqt2U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770284674; c=relaxed/simple; bh=4P2D0rOJ0z/tnUO3NaPWibjKkSOntvK1T/zFlX+f0QI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HOSba8XEuzT2RaJro0DzocfvxqPo15wYATPth3mwR0AdgK+OGWCS+GkES+goYr9pyuQwcuxxaNUalI/jBH90pxYLl2uAxrwbxslxRjeMvgygUG8YYocrctM6EDtwKpAzG6m+uB71hsjRqJrdCuxB5+3/hY88Q16Uel2jL86/wlU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (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=syvZR7b6; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (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="syvZR7b6" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=MZu9C2LpGihRDv3uKJDfxiPK0vYFTw8kaNaszsrjEtk=; b=syvZR7b6OcNkTFWSb6xagc4/aP G+hircvf6HLHzoC/4oPtAOUzUnAvylwk72yl+heCP6jgwt9/LklPpPO1rZq5g1jnBfKDLQIDbCgwe k4UZISbtXXS+WctmOEH5PFdpmxluQHrf8igiYkQ1TF8PCsTQxmB/tWDErh9GYhhjeMVVNrPM1zo55 a8aXZ4TwE2J8O6bJ4ss5o2VwGWVrP3bqognWgg/rc2MqSku2nHvSttn8bj7qPUa/JbxtRQjEoFawk pL3DViw+y8Zm5+9fp0JNeQRNO4uhEyLskFpvE7S00w+yunL3CqdfFpfR3pb3S1Ndit9Hi/uIgYGSw dfzIZU2A==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vnvuR-00000003Qe8-1BJV; Thu, 05 Feb 2026 09:44:23 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id B087C300BD2; Thu, 05 Feb 2026 10:44:22 +0100 (CET) Date: Thu, 5 Feb 2026 10:44:22 +0100 From: Peter Zijlstra To: Chuyi Zhou Cc: tglx@linutronix.de, mingo@redhat.com, luto@kernel.org, paulmck@kernel.org, muchun.song@linux.dev, bp@alien8.de, dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/11] smp: Use on-stack cpumask in smp_call_function_many_cond Message-ID: <20260205094422.GG232055@noisy.programming.kicks-ass.net> References: <20260203112401.3889029-1-zhouchuyi@bytedance.com> <20260203112401.3889029-5-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=us-ascii Content-Disposition: inline In-Reply-To: <20260203112401.3889029-5-zhouchuyi@bytedance.com> On Tue, Feb 03, 2026 at 07:23:54PM +0800, Chuyi Zhou wrote: > This patch use on-stack cpumask to replace percpu cfd cpumask in > smp_call_function_many_cond(). alloc_cpumask_var() may fail when > CONFIG_CPUMASK_OFFSTACK is enabled. In such extreme case, fall back to > cfd->cpumask. This is a preparation for the next patch. > > Signed-off-by: Chuyi Zhou > --- > kernel/smp.c | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/kernel/smp.c b/kernel/smp.c > index f572716c3c7d..35948afced2e 100644 > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -805,11 +805,17 @@ static void smp_call_function_many_cond(const struct cpumask *mask, > int cpu, last_cpu, this_cpu = smp_processor_id(); > struct call_function_data *cfd; > bool wait = scf_flags & SCF_WAIT; > + bool preemptible_wait = true; > + cpumask_var_t cpumask_stack; > + struct cpumask *cpumask; > int nr_cpus = 0; > bool run_remote = false; > > lockdep_assert_preemption_disabled(); > > + if (!alloc_cpumask_var(&cpumask_stack, GFP_ATOMIC)) > + preemptible_wait = false; IIRC this breaks RT, must not allocate with preemption disabled.