• Jason Low's avatar
    locking/spinlocks/mcs: Micro-optimize osq_unlock() · 33ecd208
    Jason Low authored
    In the unlock function of the cancellable MCS spinlock, the first
    thing we do is to retrive the current CPU's osq node. However, due to
    the changes made in the previous patch, in the common case where the
    lock is not contended, we wouldn't need to access the current CPU's
    osq node anymore.
    
    This patch optimizes this by only retriving this CPU's osq node
    after we attempt the initial cmpxchg to unlock the osq and found
    that its contended.
    Signed-off-by: default avatarJason Low <jason.low2@hp.com>
    Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
    Cc: Scott Norton <scott.norton@hp.com>
    Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
    Cc: Dave Chinner <david@fromorbit.com>
    Cc: Waiman Long <waiman.long@hp.com>
    Cc: Davidlohr Bueso <davidlohr@hp.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Tim Chen <tim.c.chen@linux.intel.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: Aswin Chandramouleeswaran <aswin@hp.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: http://lkml.kernel.org/r/1405358872-3732-5-git-send-email-jason.low2@hp.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    33ecd208
mcs_spinlock.c 4.92 KB