[PATCH v2 13/20] arm64: percpu: Add infrastructure for preemptible this_cpu_*() ops

David Hildenbrand (Arm) david at kernel.org
Thu Aug 6 06:30:10 PDT 2026


On 8/6/26 15:25, David Laight wrote:
> On Thu, 6 Aug 2026 13:32:52 +0200
> "David Hildenbrand (Arm)" <david at kernel.org> wrote:
> 
>> On 8/6/26 13:21, Mark Rutland wrote:
>>>
>>> Thanks for the pointer.
>>>
>>> IIUC in those cases you're using preempt_disable() .. preempt_enable()
>>> directly, not this_cpu_*(), right?  
>>
>> It was purely preempt_disable/preempt_enable experiments without any percpu stuff.
> 
> Did you check that preempt_enable() isn't likely to speculatively execute the
> schedule() call.
> Even if you write:
> 	if (unlikely(a == b))
> 		function();
> the compiler tends to generate a forwards branch around the function call.

I didn't look closer (Michael ran the experiments), in particular, why it added
overhead. I was assuming that it's just suboptimal code generation as you and
Mark hinted. It was sufficient for us to understand that the overhead we saw can
be removed somehow, but as we dropped the approach entirely, we didn't look
closer into that.

-- 
Cheers,

David



More information about the linux-arm-kernel mailing list