On Fri, 26 Oct 2007, Andi Kleen wrote:For registers it's fine. For memory, it's a disaster. It's more than just dirty cachelines and introducing race conditions, it's also about protection and dirty pages. So even in user space, to even be correct in the first place, the compiler would need to make sure that the variable is writable at all (or you might take a SIGSEGV), but I guess that gcc just assumes it is, at least for globals (or gcc could depend on seeing *other* writes that are done unconditionally). More likely, the compiler people don't even care, because "the C standard doesn't specify that behaviour" - ie things like write-protected memory or garbage collection based on dirty/accessed bits are outside the scope of what the language specifies. Much less things like pthreads or other synchronization primitives in threads. Linus -
| Jan Engelhardt | intel iommu (Re: -mm merge plans for 2.6.23) |
| Justin C. Sherrill | Re: dragonflybsd.org website link? |
| Greg Kroah-Hartman | [PATCH 002/196] Chinese: rephrase English introduction in HOWTO |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Patrick McHardy | [NET_SCHED 01/15]: sch_atm: fix format string warning |
