[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.01.0907021419560.3210@localhost.localdomain>
Date: Thu, 2 Jul 2009 14:28:23 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Eric Dumazet <eric.dumazet@...il.com>
cc: David Howells <dhowells@...hat.com>, mingo@...e.hu,
akpm@...ux-foundation.org, paulus@...ba.org, arnd@...db.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] FRV: Implement atomic64_t
On Thu, 2 Jul 2009, Eric Dumazet wrote:
>
> Using a fixed initial value (instead of __atomic64_read()) is even faster,
> it apparently permits cpu to use an appropriate bus transaction.
Yeah, I guess it does a "read-for-write-ownership" and allows the thing to
be done as a single cache transaction.
If we read it first, it will first get the cacheline for shared-read, and
then the cmpxchg8b will need to turn it from shared to exclusive.
Of course, the _optimal_ situation would be if the cmpxchg8b didn't
actually do the write at all when the value matches (and all cores could
just keep it shared), but I guess that's not going to happen.
Too bad there is no pure 8-byte read op. Using MMX has too many downsides.
Btw, your numbers imply that for the atomic64_add_return(), we really
would be much better off not reading the original value at all. Again, in
that case, we really do want the "read-for-write-ownership" cache
transaction, not a read.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists