public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@suse.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch 1/4] x86: FIFO ticket spinlocks
Date: Sat, 3 Nov 2007 00:01:42 +0100	[thread overview]
Message-ID: <20071102230142.GC26562@wotan.suse.de> (raw)
In-Reply-To: <alpine.LFD.0.999.0711020950250.3342@woody.linux-foundation.org>

On Fri, Nov 02, 2007 at 09:51:27AM -0700, Linus Torvalds wrote:
> 
> 
> On Fri, 2 Nov 2007, Chuck Ebbert wrote:
> > 
> > There's also a very easy way to get better fairness with our current spinlocks:
> > use xchg to release the lock instead of mov.
> 
> That does nothing at all.
> 
> Yes, it slows the unlock down, which in turn on some machines will make it 
> easier for another core/socket to get it, but it's purely about the 
> slowdown, nothing else. 

Yeah, it's not such a good idea... it slows down the single threaded case
like crazy. On my dual core core2:

_Single thread_
inc-lock in cache takes 21.94ns
xadd-lock in cache takes 22.64ns
xchg-lock in cache takes 35.21ns

inc-lock out of cache takes 140.73ns
xadd-lock out of cache takes 141.15ns
xchg-lock out of cache takes 155.13ns


In the contended multi-threaded tight loop, the xchg lock is slower than inc
lock but still beats the fair xadd lock, but that's only because it is
just as unfair if not more so on this hardware (runtime difference of up to
about 10%)

  reply	other threads:[~2007-11-02 23:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01 14:01 [patch 0/4] ticket spinlocks for x86 Nick Piggin
2007-11-01 14:02 ` [patch 1/4] spinlock: lockbreak cleanup Nick Piggin
2007-11-01 14:06   ` Peter Zijlstra
2007-11-01 14:29     ` Nick Piggin
2007-11-01 15:39       ` Lee Schermerhorn
2007-11-01 15:46         ` Ingo Molnar
2007-11-01 15:53           ` Nick Piggin
2007-11-01 14:03 ` [patch 1/4] x86: FIFO ticket spinlocks Nick Piggin
2007-11-01 14:40   ` Gregory Haskins
2007-11-01 16:38     ` Linus Torvalds
2007-11-02  0:35       ` Rik van Riel
2007-11-02  1:19         ` Linus Torvalds
2007-11-02  2:01           ` Rik van Riel
2007-11-02  6:42           ` Nick Piggin
2007-11-02 14:05             ` Rik van Riel
2007-11-02 22:37               ` Nick Piggin
2007-11-02 15:33             ` Ingo Molnar
2007-11-07  8:46               ` Nick Piggin
2007-11-02 14:24       ` Gregory Haskins
2007-11-01 20:01   ` Chuck Ebbert
2007-11-02  0:00     ` Nick Piggin
2007-11-02 16:22   ` Chuck Ebbert
2007-11-02 16:51     ` Linus Torvalds
2007-11-02 23:01       ` Nick Piggin [this message]
2007-11-03  0:56         ` Chuck Ebbert
2007-11-03  3:41           ` Nick Piggin
2007-11-01 14:04 ` [patch 3/4] x86: spinlock.h merge prep Nick Piggin
2007-11-01 14:05 ` [patch 4/4] x86: spinlock.h merge Nick Piggin
2007-11-03 22:36 ` [patch 0/4] ticket spinlocks for x86 Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071102230142.GC26562@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=ak@suse.de \
    --cc=cebbert@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox