Volatile vs Non-Volatile Spin Locks on SMP.
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · [email protected] wrote:
Hello,
By using volatile keyword for spin lock defined by in
spinlock_t, it seems Linux choose to always reload the value of spin locks from cache instead of using the content from registers. This may be helpful for synchronization between multithreads in a single CPU.I use two Xeon cpus with HyperThreading being disabled on both cpus. I think the MESI protocol will enforce the cache coherency and update the spin lock value automatically between these two cpus. So maybe we don't need to use the volatile any more, right?
The value must always be loaded from memory. If the value is cached in a register it will not update when another CPU changes it.
Signature · 3 lines
Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from [email protected] Home Page: http://www.roberthancock.com/