On Thu, 6 Jul 2006, linux-os (Dick Johnson) wrote: > > Linus, you may have been reading too many novels. > > If I have some code that does: > > extern int spinner; > > funct(){ > while(spinner) > ; > > The 'C' compiler has no choice but to actually make that memory access > and read the variable because the variable is in another module (a.k.a. > file). You don't know how C works, do you? You also have no idea of what out-of-order memory accesses do to OS code, right? THE FACT IS, "volatile" IS USELESS, BADLY DEFINED, AND AN ALMOST COMPLETELY SURE SIGN OF BUGS. Go on, do your own OS, and try to use "volatile" in it as the serialization abstraction. I personally will guarantee that you will fail. But hey, you can prove me wrong. In the meantime, in Linux, "volatile" is considered a bug in any but the two special cases I already mentioned. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [patch] spinlocks: remove 'volatile'
- From: "J.A. Magallón" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- References:
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Andrew Morton <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Andrew Morton <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Ingo Molnar <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- From: Linus Torvalds <[email protected]>
- [patch] spinlocks: remove 'volatile'
- From: Ingo Molnar <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: Linus Torvalds <[email protected]>
- Re: [patch] spinlocks: remove 'volatile'
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: [patch] uninline init_waitqueue_*() functions
- Prev by Date: Re: NULL terminate over-long /proc/kallsyms symbols
- Next by Date: Re: [PATCH 1/1] Only use ARCH_PFN_OFFSET once during boot
- Previous by thread: Re: [patch] spinlocks: remove 'volatile'
- Next by thread: Re: [patch] spinlocks: remove 'volatile'
- Index(es):