SMP and too Optimistic Compiler Optimization
In a nowadays common SMP/CMP environment with more then one CPU it is necessary to protect global/shared data in the kernel. One prominent example are sysctl_ variables. Sysctl variables are protected via a spin lock (sysctl_lock). This look protect the /proc/sysctl interface path, the look itself does not protect the usage path itself. Consider the following example: int global\_val; int foo(void) { if (global\_val != 0) { int res = bar(); return res / global\_val; } return -1; } Here global_val is a global accessible variable....