From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-112.ptr.blmpb.com (va-1-112.ptr.blmpb.com [209.127.230.112]) (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 5A9463DB33A for ; Wed, 3 Jun 2026 11:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780487719; cv=none; b=ErTCrBeWk9M6TMZOT/nhIKS2WvGWhvS/ZOO+lrnTStnL19lODlJV0MKNrCSFJkvgsGLP7A92bJu8KHdZkvfg/jjZ07Vict0OP+h6MUNBPHP77HA7D4qn/5OwviGsQ7AsMngfQ+4MhViLjmphVsvkb/KfpqlI8tkWszppJj5IVLI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780487719; c=relaxed/simple; bh=H1BsdRXflFKO9Ae7Le2L6VMF0RNABBqo8de/1RxHtSY=; h=Subject:Date:Message-Id:To:Mime-Version:References:Cc:From: In-Reply-To:Content-Type; b=Gj+EOxYATUucxwP0WIW6E0ZhHsuvA2hNC1hNyJTFh11VgqvelGnMBz0KnuXqCQ1BNmf8TJaw8HDPMxETMh45HSn/z0MM3rMJC14C4gu0A1gCAcuR71r0z1mkYXBWM/PwL/cVAKk+PRHgXrYz7XruGW6eeMmejwlKa67PLUQMSBI= 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=bRxLGBWE; arc=none smtp.client-ip=209.127.230.112 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="bRxLGBWE" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1780487714; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=lRtJRnGzNR2hfaZV2oe3hvAdHNYqu+Flq77zTL+WB3Y=; b=bRxLGBWE15qT29N954ZYrxp5udrsok8VstzLbOVUgL7pUfyfIqW+GEhbrHC87Ge/xlq3cj c7EnrEGJfXv3kAfllTevwea96pjPccGpQ5YYSbC4d53jZvKGdoYd+XBOaSOgCSdKDlb6NB Ra+LABbdj/hfoP23QWfoUJJQEpcAuCAQacBh7NL/gJcHLOuH4itiCxaozF0UGqXcWx4A+h TCAfo9OR9ks2wlxrVkDjwqxOyZMGiGJVzidqE/E3Bo9gVc36TaHaSipfdd4m7y/gKaaRQX BbpEimjaDEarcNqQ7s2weoUCIxLaZS//u5RfLBu02UfBJavy9eD5YwP9aaiIww== Subject: Re: [PATCH v6 06/12] smp: Enable preemption early in smp_call_function_many_cond Date: Wed, 3 Jun 2026 19:54:34 +0800 Message-Id: <5de709b7-674f-49ba-8915-cfc2407263a5@bytedance.com> X-Original-From: Chuyi Zhou User-Agent: Mozilla Thunderbird To: "Sebastian Andrzej Siewior" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Lms-Return-Path: References: <20260528151338.617843-1-zhouchuyi@bytedance.com> <20260528151338.617843-7-zhouchuyi@bytedance.com> <20260603110056.kUcKG8er@linutronix.de> Content-Transfer-Encoding: 7bit Cc: , , , , , , , , , , , , From: "Chuyi Zhou" In-Reply-To: <20260603110056.kUcKG8er@linutronix.de> Content-Type: text/plain; charset=UTF-8 On 2026-06-03 7:00 p.m., Sebastian Andrzej Siewior wrote: > On 2026-05-28 23:13:32 [+0800], Chuyi Zhou wrote: >> --- a/kernel/smp.c >> +++ b/kernel/smp.c >> @@ -953,6 +952,17 @@ static void smp_call_function_many_cond(const struct cpumask *mask, >> local_irq_restore(flags); >> } >> >> + /* >> + * Waiting for completion can take time especially with many CPUs. >> + * On a PREEMPTIBLE kernel a per-task cpumask is used to track CPUs > > I wouldn't use PREEMPTIBLE. It is PREEMPT which short for > CONFIG_PREEMPT. PREEMPTIBLE is not a distinct entity since "preemptible" > can be changed at runtime. Right, PREEMPT/!PREEMPT is the better wording here. I will update the comment accordingly. > >> + * with pending IPI request. This allows to enable preemption and >> + * potentially wait while allowing task preemption. On a !PREEMPTIBLE >> + * the cpumask is shared and the call must block until completion to >> + * avoid modifications by a another caller on this CPU. >> + */ >> + if (task_mask) >> + put_cpu(); >> + >> if (run_remote && wait) { >> for_each_cpu(cpu, cpumask) { >> call_single_data_t *csd; > > Other than that, > > Reviewed-by: Sebastian Andrzej Siewior > > Sebastian