memory locking latencies
Posted: Sat Feb 02, 2008 8:20 am
this is very platform specific, but I'd like to have some ideas on the latency involved in the memory locking instructions.
best case is basically:
cpu 1 "hey guys, I want to write memory/cache line #n"
other cpus "OK"
cpu 1 "done, I got the new (dirty) cache line#n here, anyone ask me if they need it"
and I guess it just doesnt relinquish the line as long as its local lock is on (lock xchg executing), so as long as it already has ownership of the dirty line it doesnt need to go thru the whole protocol.
but this must be a killer on global locks shared between cpus, anyone got links on actual timing numbers ? "how much time would it take on architecture X to transfer a line from L1 cache to L1 cache between cpus in a best case scenario"
I got a dual opteron and an amd x2 to test but I suspect just putting two cpus fighting for a lock in a loop wouldnt be accurate as some hardware optimizations and bus "opportunity windows" would likely come into play into such an aggressive test.
best case is basically:
cpu 1 "hey guys, I want to write memory/cache line #n"
other cpus "OK"
cpu 1 "done, I got the new (dirty) cache line#n here, anyone ask me if they need it"
and I guess it just doesnt relinquish the line as long as its local lock is on (lock xchg executing), so as long as it already has ownership of the dirty line it doesnt need to go thru the whole protocol.
but this must be a killer on global locks shared between cpus, anyone got links on actual timing numbers ? "how much time would it take on architecture X to transfer a line from L1 cache to L1 cache between cpus in a best case scenario"
I got a dual opteron and an amd x2 to test but I suspect just putting two cpus fighting for a lock in a loop wouldnt be accurate as some hardware optimizations and bus "opportunity windows" would likely come into play into such an aggressive test.