tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mutexes, locks and so on...



On Nov 16, 2010, at 9:10 AM, Alan Barrett wrote:

> Please could somebody on the "eat your CAS whether you like it or not"
> side of the fence explain why the following idea would not work:
> 
> On Sat, 13 Nov 2010, der Mouse wrote:
>> Consider this hypothetical:
>> 
>> x86 does #define ATOMIC_OPS_USE_CAS and defines a CAS(); MI code
>> notices this and defines all the higher-level primitives (if that's not
>> too much of an oxymoron) in terms of CAS().
>> 
>> ppc, arm, all the arches sufficiently "modern" to have CAS, likewise.
>> 
>> Arches without a sufficiently general CAS[%] do not define
>> ATOMIC_OPS_USE_CAS and provides their own implementations of mutexes,
>> spinlocks, whatever.

Because that flexibility already exists.  A port can provide a full
mutex or rwlock implementation or use the default based on CAS primitives.

I think the question is about more about the naked use of atomic_cas_xxx
which are scattered around in the kernel.  


Home | Main Index | Thread Index | Old Index