Re: [RESEND PATCH v5 04/12] smp: Use task-local IPI cpumask in smp_call_function_many_cond()
From: Chuyi Zhou
Date: Thu May 21 2026 - 12:29:36 EST
On 2026-05-21 11:26 p.m., Sebastian Andrzej Siewior wrote:
> On 2026-05-13 20:45:16 [+0800], Chuyi Zhou wrote:
>> diff --git a/kernel/smp.c b/kernel/smp.c
>> index 9e9dab3b0d51..630c8e5a635d 100644
>> --- a/kernel/smp.c
>> +++ b/kernel/smp.c
>> @@ -811,11 +849,18 @@ 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;
>> + struct cpumask *cpumask, *task_mask;
>> + bool preemptible_wait;
>> int nr_cpus = 0;
>> bool run_remote = false;
>>
>> lockdep_assert_preemption_disabled();
>>
>> + task_mask = smp_task_ipi_mask(current);
>> + preemptible_wait = task_mask;
>> + cfd = this_cpu_ptr(&cfd_data);
>> + cpumask = preemptible_wait ? task_mask : cfd->cpumask;
>
> Is this a porting artifact? preemptible_wait is a bool while task_mask
> is a pointer which is always != NULL.
>
Not exactly. The NULL fallback is intentional: smp_task_ipi_mask()
returns NULL for !CONFIG_PREEMPTION, and init_task may also not have an
allocated ipi_mask_ptr in the non-inlined case.
But you are right that the name is confusing in this preparatory patch.
Here it only means "task-local cpumask is available", not that the wait is
actually preemptible. I will drop this bool in this patch, and keep
the real preemptible wait condition in the later patch as:
preemptible_wait = task_mask && preemptible();
> UP to here the patches and the code made sense.
>
>> +
>> /*
>> * Can deadlock when called with interrupts disabled.
>> * We allow cpu's that are not yet online though, as no one else can
>
> Sebastian