From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-2-115.ptr.blmpb.com (va-2-115.ptr.blmpb.com [209.127.231.115]) (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 631FF4219F6 for ; Thu, 9 Jul 2026 12:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.231.115 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783600337; cv=none; b=XyF8Y/WMvoNerP8RY9JNUhUwDPFSj6DKbgbIbHyjGy0XK5o69II6bIPpTl5JaswbBjxpIzGtKW13FXC5pPeAtESeKQClt/8VnpXp66bFR5o9pPNxhVMGVfF06nH3zy5Lrkv6g1NY2WWy4stx3Bx1zy5pisyKeSxg5juoVjmroZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783600337; c=relaxed/simple; bh=myP0buM5z6qW83LKVM/a+WzW4lrrbGXnYn1jzcP/VSg=; h=References:To:Date:Cc:Subject:Mime-Version:In-Reply-To:From: Message-Id:Content-Type; b=o5tFba65vluQ/I0XShPDO8Z/VzLET8bGk/HjhumgxwqvtVdNYLryveuOzWvGzqTEtGOe0wdCROJ8JPQTCItA3iNrGjqXUPhkk5qpFIza0kpCcx/FCfT/H/PR4HFtkTeEMuH26igq+PaCDWOUPiwbBr/6zA1MF1xXMTWZ/ygAAVw= 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=kk3dkcLa; arc=none smtp.client-ip=209.127.231.115 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="kk3dkcLa" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1783600331; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=R+Qxy1h+Z8INVim4kRMfVc89n30K8VY7ICdU5jPM0OQ=; b=kk3dkcLalBY9Lx43E8U7EOC9bM2QhQgCtHmZRDclqOWDVDIULslfazwaUpLGfUYb+k72qp b2g+dHgjXKyC18/3Lxr9+cSsrQWTPOo0MgVOtXIQQJZL1SqLdqD/eFaA3vsgOTcEAZkq1+ mwBExIMcA1RTZ/WlCtrJYQXviqxhWWwKJTmsKYedyEM3nyeduJB83zM15l0VKsRj3FhiDW cleff33rDo7XXNNVQlQ7PbaMCKy6KEOVCMbd5uzRHUXf9KL8CV1+A9DsfMobndZDm5W/Rn LZbON2G3bbP0qswK8cwkWZg8p1+TtAxnz7LU02PqeSFqh7nuNmtRmfocO0T6tw== References: <20260709122933.4021501-1-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 To: , , , , , , , , , , , , , Date: Thu, 9 Jul 2026 20:29:27 +0800 X-Lms-Return-Path: Cc: , "Chuyi Zhou" Subject: [PATCH v10 08/14] smp: Remove preempt_disable() from on_each_cpu_cond_mask() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 In-Reply-To: <20260709122933.4021501-1-zhouchuyi@bytedance.com> From: "Chuyi Zhou" Message-Id: <20260709122933.4021501-9-zhouchuyi@bytedance.com> Content-Type: text/plain; charset=UTF-8 X-Original-From: Chuyi Zhou Content-Transfer-Encoding: 7bit smp_call_function_many_cond() handles the preemption and CPU pinning requirements internally. on_each_cpu_cond_mask() only builds the call flags and forwards the request to that helper. Remove the outer preempt_disable() and preempt_enable() pair from on_each_cpu_cond_mask(). Signed-off-by: Chuyi Zhou Tested-by: Paul E. McKenney Reviewed-by: Muchun Song Reviewed-by: Sebastian Andrzej Siewior --- kernel/smp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/smp.c b/kernel/smp.c index 5226f6879561..de04335524d8 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -1114,12 +1114,14 @@ void __init smp_init(void) * @func: The function to run on all applicable CPUs. * This must be fast and non-blocking. * @info: An arbitrary pointer to pass to both functions. - * @wait: If true, wait (atomically) until function has - * completed on other CPUs. + * @wait: If true, wait until function has completed on other CPUs. * @mask: The set of cpus to run on (only runs on online subset). * - * Preemption is disabled to protect against CPUs going offline but not online. - * CPUs going online during the call will not be seen or sent an IPI. + * Target CPU selection and work queueing are done with preemption + * disabled. This protects against CPUs going offline, but not against + * CPUs coming online concurrently; newly online CPUs are not guaranteed + * to be seen or sent an IPI. If @wait is true, the final wait for remote + * completion happens after that preemption-disabled section. * * You must not call this function with disabled interrupts or * from a hardware interrupt handler or from a bottom half handler. @@ -1132,9 +1134,7 @@ void on_each_cpu_cond_mask(smp_cond_func_t cond_func, smp_call_func_t func, if (wait) scf_flags |= SCF_WAIT; - preempt_disable(); smp_call_function_many_cond(mask, func, info, scf_flags, cond_func); - preempt_enable(); } EXPORT_SYMBOL(on_each_cpu_cond_mask); -- 2.20.1