lkml.org 
[lkml]   [2014]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
    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.


    \
     
     \ /
      Last update: 2014-01-31 21:21    [W:3.938 / U:0.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site