Re: [PATCH v8 15/19] locking/rwsem: Adaptive disabling of reader optimistic spinning

From: Waiman Long
Date: Tue Jun 04 2019 - 14:25:27 EST


On 6/4/19 2:14 PM, Peter Zijlstra wrote:
>> I worked on this owner merging patch mainly to alleviate the need to use
>> cmpxchg for reader lock. cmpxchg_double() is certainly one possible
>> solution though it won't work on older CPUs. We can have a config option
>> to use cmpxchg_double as it may increase the size of other structures
>> that embedded rwsem and impose additional alignment constraint.
> cmpxchg8b was introduced with the Pentium (for PAE IIRC, it enabled
> atomic 64bit PTEs, but Linux never used it for that) and every Intel/AMD
> thereafter has had it. AFAIK there's no x86_64 chip without cmpxchg16b.

Thank for the clarification. I actually didn't check when cmpxch8b was
introduced. I know it is a bit slower than regular cmpxchg. So we may
still need to do some performance analysis to see how it compares with
my current approach.

Cheers,
Longman