Re: test_and_set_bit implementation

From: Matthew Wilcox <matthew_at_wil.cx>
Date: 2006-12-13 05:07:44
On Tue, Dec 12, 2006 at 09:22:44AM -0800, Christoph Lameter wrote:
> On Tue, 12 Dec 2006, Matthew Wilcox wrote:
> 
> > The original code and your rewrite both access memory twice in the loop.
> > Why don't we do it with one memory reference per loop instead?
> 
> Because the the cmpxchg usually succeeds. It is rare that we have to redo 
> the loop.

Even if the loop executes exactly once, we still win by an ld4 vs an
ld4.acq.  It can't be less expensive to do an ld4.acq than it is to do
an ld4.
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Dec 13 05:08:55 2006

This archive was generated by hypermail 2.1.8 : 2006-12-13 05:09:06 EST