Messages in this thread |  | | | Date | Fri, 16 Dec 2005 08:33:10 -0800 (PST) | | From | Linus Torvalds <> | | Subject | Re: [PATCH 1/19] MUTEX: Introduce simple mutex implementation |
| |
On Fri, 16 Dec 2005, David Howells wrote: > > Of course, CMPXCHG doesn't have to store either, though it still performs a > locked-write-cycle on x86 if I remember correctly.
It does so on any sane architecture (side note: you don't do locked memory cycles on the bus these days. You do cache coherency protocols).
From a bus standpoint you _have_ to do the initial read with intent to write, nothing else makes any sense. You'll just waste bus cycles otherwise. Sure, the write may never come, but it just isn't sensible to optimize for the case where the compare will fail. If that's the common case, then software is doing something wrong (it should do just a much cheaper "load + compare" first if it knows it's probably going to fail).
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |