lkml.org 
[lkml]   [2005]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateFri, 16 Dec 2005 08:33:10 -0800 (PST)
FromLinus Torvalds <>
SubjectRe: [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/

\
 
 \ /
  Last update: 2009-11-18 23:46    [from the cache]
©2003-2010