> /*
> * Force strict CPU ordering.
> * And yes, this is required on UP too when we're talking
> * to devices.
> */
> #define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
>
> I also remeber this issue on linux-kernel some time ago (when Linus
> suggested people to use cpuid to implement mb(), but maybe I have
> understood things wrong...).
no thats correct. The above implementation was found (and benchmarked) to
be the most cache-friendly serializing+synchronizing instruction: 0(%esp)
is very likely in the L1/L2 cache, and is local to the executing process
so it's not in any other system cache, plus it does not clobber any
registers. (unlike CPUID which clobbers a handful or generic registers)
-- mingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/