[PATCH] Document Linux's memory barriers [try #2]
Linus Torvalds
torvalds at osdl.org
Thu Mar 9 16:38:36 EST 2006
On Thu, 9 Mar 2006, Paul Mackerras wrote:
>
> A spin_lock does show up on the bus, doesn't it?
Nope.
If the lock entity is in a exclusive cache-line, a spinlock does not show
up on the bus at _all_. It's all purely in the core. In fact, I think AMD
does a spinlock in ~15 CPU cycles (that's the serialization overhead in
the core). I think a P-M core is ~25, while the NetBurst (P4) core is much
more because they have horrible serialization issues (I think it's on the
order of 100 cycles there).
Anyway, try doing a spinlock in 15 CPU cycles and going out on the bus for
it..
(Couple that with spin_unlock basically being free).
Now, if the spinlocks end up _bouncing_ between CPU's, they'll obviously
be a lot more expensive.
Linus
More information about the Linuxppc64-dev
mailing list