All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>, Waiman Long <Waiman.Long@hp.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Dave Jones <davej@redhat.com>,
	Clark Williams <williams@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Davidlohr Bueso <davidlohr.bueso@hp.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Chandramouleeswaran, Aswin" <aswin@hp.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Andrew Morton <akpm@linux-foundation.org>,
	tony.luck@intel.com
Subject: Re: [PATCH RFC 1/3] mutex: Make more scalable by doing less atomic operations
Date: Wed, 10 Apr 2013 09:09:25 -0500	[thread overview]
Message-ID: <20130410140925.GD3672@sgi.com> (raw)
In-Reply-To: <CA+55aFztAtpiGK9e_Ed=Kk4jAWNTahv9OEb0+fgp52Api1s7Mw@mail.gmail.com>

On Mon, Apr 08, 2013 at 07:38:39AM -0700, Linus Torvalds wrote:
> On Mon, Apr 8, 2013 at 5:42 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > AFAICS the main performance trade-off is the following: when the owner CPU unlocks
> > the mutex, we'll poll it via a read first, which turns the cacheline into
> > shared-read MESI state. Then we notice that its content signals 'lock is
> > available', and we attempt the trylock again.
> >
> > This increases lock latency in the few-contended-tasks case slightly - and we'd
> > like to know by precisely how much, not just for a generic '10-100 users' case
> > which does not tell much about the contention level.
> 
> We had this problem for *some* lock where we used a "read + cmpxchg"
> in the hotpath and it caused us problems due to two cacheline state
> transitions (first to shared, then to exclusive). It was faster to
> just assume it was unlocked and try to do an immediate cmpxchg.
> 
> But iirc it is a non-issue for this case, because this is only about
> the contended slow path.
> 
> I forget where we saw the case where we should *not* read the initial
> value, though. Anybody remember?

I think you might be remembering ia64.  Fairly early on, I recall there
being a change in the spinlocks where we did not check them before just
trying to acquire.

Thanks,
Robin

  parent reply	other threads:[~2013-04-10 14:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 14:54 [PATCH RFC 0/3] mutex: Improve mutex performance by doing less atomic-ops & spinning Waiman Long
2013-04-04 14:54 ` [PATCH RFC 1/3] mutex: Make more scalable by doing less atomic operations Waiman Long
2013-04-08 12:42   ` Ingo Molnar
2013-04-08 14:38     ` Linus Torvalds
2013-04-08 15:09       ` Ingo Molnar
2013-04-08 17:53       ` Waiman Long
2013-04-10 10:31         ` Ingo Molnar
2013-04-10 15:52           ` Waiman Long
2013-04-10 17:16             ` Ingo Molnar
2013-04-10 21:26               ` Waiman Long
2013-04-11  9:07                 ` Ingo Molnar
2013-04-10 14:09       ` Robin Holt [this message]
2013-04-10 15:46         ` Linus Torvalds
2013-04-08 17:42     ` Waiman Long
2013-04-10 10:28       ` Ingo Molnar
2013-04-10 15:47         ` Waiman Long
2013-04-04 14:54 ` [PATCH RFC 2/3] mutex: restrict mutex spinning to only one task per mutex Waiman Long
2013-04-04 14:54 ` [PATCH RFC 3/3] mutex: dynamically disable mutex spinning at high load Waiman Long

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=20130410140925.GD3672@sgi.com \
    --to=holt@sgi.com \
    --cc=Waiman.Long@hp.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=aswin@hp.com \
    --cc=davej@redhat.com \
    --cc=davidlohr.bueso@hp.com \
    --cc=dhowells@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=williams@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.