Messages in this thread |  | | Date | Mon, 6 May 1996 21:05:42 +0300 (EET DST) | From | Linus Torvalds <> | Subject | Re: Is clobber "memory" in include/asm-i386/system.h necessary? |
| |
On Sat, 4 May 1996, Warner Losh wrote: > > : "volatile" itself causes suboptimal code to be generated > : even in places where it's unnecessary, such as between cli() and sti(). > > What about MP machines? Wouldn't volatile still be needed between a > cli() and sti() because other processors might change the value out > from under you? Granted, a higher level of locking would prevent > that, but there are cases where you might want that to happen (like in > the lock manager code, assuming it uses atomic memory access > instructions).
"volatile" is _never_ a good idea, even in SMP. You already touched on why it's not a good idea: it's unnecessary if we have some locking to prevent concurrent accesses.
Now, if we DON'T have locking that prevents concurrent accesses, then we have a major bug in the system.
Ergo, using "volatile" means that we have a major bug in the system.
QED.
Linus
|  |