[PATCH] arm64: percpu: Make this_cpu accessors pre-empt safe

Will Deacon will.deacon at arm.com
Fri Mar 20 11:02:29 PDT 2015


On Thu, Mar 19, 2015 at 04:39:55PM +0000, Mark Rutland wrote:
> On Thu, Mar 19, 2015 at 04:27:53PM +0000, Will Deacon wrote:
> >   (3) Preemption isn't actually an issue here -- CPU migration is. I'd
> >       expect that to be a lot rarer.
> 
> That's not true: in a read-modify-cmpxchg loop (even on a UP system) if
> you get preempted at the end of the read and another thread modifies
> your datastructure, then your subsequent cmpxchg will fail. So any
> preemption could cause you to have to retry, so you want to miminise
> potential preemptions.
> 
> Note that this is a performance argument rather than a correctness
> argument.

My argument is more that a migration will always break the cmpxchg, whereas
preemption doesn't necessarily.

Steve -- can you respin this using preempt_enable everywhere please?

Will



More information about the linux-arm-kernel mailing list