Re: [PATCH v4 04/12] smp: Use task-local IPI cpumask in smp_call_function_many_cond()

From: Chuyi Zhou

Date: Wed Apr 01 2026 - 12:00:30 EST


On 2026-04-01 11:25 p.m., Sebastian Andrzej Siewior wrote:
> On 2026-03-31 19:30:55 [+0800], Chuyi Zhou wrote:
>
>> --- a/kernel/smp.c
>> +++ b/kernel/smp.c
>> @@ -802,11 +840,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 && preemptible();
>> + cfd = this_cpu_ptr(&cfd_data);
>> + cpumask = preemptible_wait ? task_mask : cfd->cpumask;
>
> I haven't look at this in detail but that
> lockdep_assert_preemption_disabled() expects preemption to be disabled
> here so the following preemptible() must be always false.
>

Yes, perhaps the preemptible() check is not needed in this patch.

It would be better to add the preemptible() check in [patch 06/12].

>> +
>> /*
>> * Can deadlock when called with interrupts disabled.
>> * We allow cpu's that are not yet online though, as no one else can
>
> Sebastian