I did LOOK at the latest Linux Kernel source code that implements spinlocks. Not a volatile in sight.bob wrote:See my reply to Ronald right below this post. I found a thousand just going a few levels deep in the directory structure for 3.13.6, the current fedora 20 kernel.Rein Halbersma wrote:Yes, please show us:bob wrote:Just factual. Want me to show you the volatile ints in the kernel source for spin locks?syzygy wrote:Your insight in these matters is just amazing.bob wrote:
Pretty funny discussion however, since the KERNEL uses volatile for its own spin locks among other things..
https://github.com/torvalds/linux/blob/ ... spinlock.h
https://github.com/torvalds/linux/blob/ ... spinlock.c
Care to try again?
Or at least LOOK again?
Yes, and this was not done silently, but after a huge debate on lkml all the way back in 2006: http://lkml.iu.edu//hypermail/linux/ker ... /1449.html You should read Linus's comments on the use of volatile, you might be surprised, and who knows, you'll learn something.It looks like the lock stuff was completely rewritten, eliminating the spin locks that burn cycles, adding a queue that everyone lines up in to gain access. Cute idea.
But wait, there's more: it even got summarized in an abridged version for challenged readers on LWN.net back in 2007: http://lwn.net/Articles/233482/
Oh yes, your side argument of looking at all other non-spinlock related code. Well, true, there is plenty of volatile, even in the Linux Kernel. In fact, in 2006 there were over 10K occurances of volatile in the entire source tree. Most of them in drivers, and many of them are still there. But NOT in the spinlock code itself anymore.STILL plenty of volatiles around.
Erm, you might want to read the links I posted above.The lock used in Crafty came from older kernel sources. Still works flawlessly.