summaryrefslogtreecommitdiff
path: root/arch/ia64/mm/tlb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-11-02 10:22:25 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-11-02 10:22:25 -0800
commit333a07437c31ea8c16a2b82071629a540ae1e50f (patch)
treeb2bc63d29d22238add7e4eb66ed841e7cf6b6932 /arch/ia64/mm/tlb.c
parentd4da6c9ccf648f3f1cb5bf9d981a62c253d30e28 (diff)
parente8c93fc7b7221b6ac7e7ddbd0e21e205bf9e801a (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6: Revert "[IA64] fix percpu warnings" [IA64] fix percpu warnings [IA64] SMT friendly version of spin_unlock_wait() [IA64] use printk_once() unaligned.c/io_common.c [IA64] Require SAL 3.2 in order to do extended config space ops [IA64] unsigned cannot be less than 0 in sn_hwperf_ioctl() [IA64] Restore registers in the stack on INIT [IA64] Re-implement spinaphores using ticket lock concepts [IA64] Squeeze ticket locks back into 4 bytes.
Diffstat (limited to 'arch/ia64/mm/tlb.c')
-rw-r--r--arch/ia64/mm/tlb.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index f426dc78d959..ee09d261f2e6 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -100,24 +100,36 @@ wrap_mmu_context (struct mm_struct *mm)
* this primitive it can be moved up to a spinaphore.h header.
*/
struct spinaphore {
- atomic_t cur;
+ unsigned long ticket;
+ unsigned long serve;
};
static inline void spinaphore_init(struct spinaphore *ss, int val)
{
- atomic_set(&ss->cur, val);
+ ss->ticket = 0;
+ ss->serve = val;
}
static inline void down_spin(struct spinaphore *ss)
{
- while (unlikely(!atomic_add_unless(&ss->cur, -1, 0)))
- while (atomic_read(&ss->cur) == 0)
- cpu_relax();
+ unsigned long t = ia64_fetchadd(1, &ss->ticket, acq), serve;
+
+ if (time_before(t, ss->serve))
+ return;
+
+ ia64_invala();
+
+ for (;;) {
+ asm volatile ("ld4.c.nc %0=[%1]" : "=r"(serve) : "r"(&ss->serve) : "memory");
+ if (time_before(t, serve))
+ return;
+ cpu_relax();
+ }
}
static inline void up_spin(struct spinaphore *ss)
{
- atomic_add(1, &ss->cur);
+ ia64_fetchadd(1, &ss->serve, rel);
}
static struct spinaphore ptcg_sem;