On Fri, Jan 31, 2014 at 02:24:33PM -0500, Waiman Long wrote: > On 01/31/2014 10:08 AM, Peter Zijlstra wrote: > >Whereas for the straight cmpxchg() you'd get something relatively simple > >like: > > > > mov %edx,%eax > > lock cmpxchg %ecx,(%rbx) > > cmp %edx,%eax > > jne ... > > I believe the speeds of the lock functions are about the same. However, > qspinlock has a much simpler unlock function which probably account of most > of the speed gain. The unlock path for ticket locks is a single "add[bw] $0x1,()", that should be as fast as the single "movb 0,()" you have. > >I suppose we could from the ticket code more and optimize the > >uncontended path, but that'll make the contended path more expensive > >again, although probably not as bad as hitting a new cacheline. > > I don't get what you are trying to say. I said we could probably make the ticket lock function faster for the uncontended case by making the contended case slightly more expensive. -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html