On Fri, Feb 7, 2014 at 10:28 PM, Torsten Duwe <d...@lst.de> wrote: > Ticket locks for ppc, version 2. Changes since v1: > * The atomically exchanged entity is always 32 bits. > * asm inline string variations thus removed. > * Carry the additional holder hint only #if defined(CONFIG_PPC_SPLPAR) > > Signed-off-by: Torsten Duwe <d...@suse.de> > -- [...] > +static __always_inline void arch_spin_lock(arch_spinlock_t *lock) > { > + register struct __raw_tickets old, tmp, > + inc = { .tail = TICKET_LOCK_INC }; > + > CLEAR_IO_SYNC; > - while (1) { > - if (likely(__arch_spin_trylock(lock) == 0)) > - break; > + __asm__ __volatile__( > +"1: lwarx %0,0,%4 # arch_spin_lock\n" > +" add %1,%3,%0\n" > + PPC405_ERR77(0, "%4") > +" stwcx. %1,0,%4\n" > +" bne- 1b" > + : "=&r" (old), "=&r" (tmp), "+m" (lock->tickets) > + : "r" (inc), "r" (&lock->tickets) > + : "cc"); > + > + if (likely(old.head == old.tail)) > + goto out; > + > + for (;;) { > + unsigned count = 100;
I am sure you wanted to tune the total loops to typical lock holding time ... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/