Re: [PATCH v6 06/12] smp: Enable preemption early in smp_call_function_many_cond

From: Chuyi Zhou

Date: Wed Jun 03 2026 - 08:08:42 EST


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 <bigeasy@xxxxxxxxxxxxx>
>
> Sebastian