[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-67d7178f8fc64b7f68d7dd8a1b21dfa0d42c220c@git.kernel.org>
Date: Fri, 3 Jul 2009 12:48:46 GMT
From: tip-bot for Eric Dumazet <eric.dumazet@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, eric.dumazet@...il.com,
a.p.zijlstra@...llo.nl, torvalds@...ux-foundation.org,
efault@....de, arnd@...db.de, dhowells@...hat.com,
fweisbec@...il.com, akpm@...ux-foundation.org, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perfcounters/urgent] x86: atomic64: Improve atomic64_read()
Commit-ID: 67d7178f8fc64b7f68d7dd8a1b21dfa0d42c220c
Gitweb: http://git.kernel.org/tip/67d7178f8fc64b7f68d7dd8a1b21dfa0d42c220c
Author: Eric Dumazet <eric.dumazet@...il.com>
AuthorDate: Fri, 3 Jul 2009 13:23:02 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 3 Jul 2009 14:42:59 +0200
x86: atomic64: Improve atomic64_read()
Optimize atomic64_read() as a special open-coded
cmpxchg8b variant. This generates nicer code:
arch/x86/lib/atomic64_32.o:
text data bss dec hex filename
435 0 0 435 1b3 atomic64_32.o.before
431 0 0 431 1af atomic64_32.o.after
md5:
bd8ab95e69c93518578bfaf0ea3be4d9 atomic64_32.o.before.asm
2bdfd4bd1f6b7b61b7fc127aef90ce3b atomic64_32.o.after.asm
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: David Howells <dhowells@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>
LKML-Reference: <alpine.LFD.2.01.0907021653030.3210@...alhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
arch/x86/lib/atomic64_32.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c
index fd28fd3..cd11803 100644
--- a/arch/x86/lib/atomic64_32.c
+++ b/arch/x86/lib/atomic64_32.c
@@ -62,9 +62,17 @@ void atomic64_set(atomic64_t *ptr, u64 new_val)
*/
u64 atomic64_read(atomic64_t *ptr)
{
- u64 old = 1LL << 32;
+ u64 res;
- return cmpxchg8b(&ptr->counter, old, old);
+ asm volatile(
+ "mov %%ebx, %%eax\n\t"
+ "mov %%ecx, %%edx\n\t"
+ LOCK_PREFIX "cmpxchg8b %1\n"
+ : "+A" (res)
+ : "m" (*ptr)
+ );
+
+ return res;
}
/**
--
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