[tip:x86/spinlocks] x86, ticketlock: Use xadd helper

From: tip-bot for Jeremy Fitzhardinge
Date: Fri Jul 22 2011 - 15:58:46 EST


Commit-ID: 599c3e7724ab4520c6f11857eb953271d365f842
Gitweb: http://git.kernel.org/tip/599c3e7724ab4520c6f11857eb953271d365f842
Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
AuthorDate: Thu, 23 Jun 2011 18:19:20 -0700
Committer: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
CommitDate: Fri, 22 Jul 2011 11:19:05 -0700

x86, ticketlock: Use xadd helper

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/aa7c94ecfbee05a6b8e455271ba0bb467bf33b2f.1308878118.git.jeremy.fitzhardinge@xxxxxxxxxx
Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
---
arch/x86/include/asm/spinlock.h | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index e07dc41..da196f1 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -71,14 +71,7 @@ static __always_inline struct __raw_tickets __ticket_spin_claim(struct arch_spin
{
register struct __raw_tickets tickets = { .tail = 1 };

- if (sizeof(lock->tickets.head) == sizeof(u8))
- asm volatile (LOCK_PREFIX "xaddw %w0, %1\n"
- : "+r" (tickets), "+m" (lock->tickets)
- : : "memory", "cc");
- else
- asm volatile (LOCK_PREFIX "xaddl %0, %1\n"
- : "+r" (tickets), "+m" (lock->tickets)
- : : "memory", "cc");
+ xadd(&lock->tickets, tickets);

return tickets;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/