public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Waiman Long <Waiman.Long@hp.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Richard Weinberger <richard@nod.at>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matt Fleming <matt.fleming@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Michel Lespinasse <walken@google.com>,
	Andi Kleen <andi@firstfloor.org>, Rik van Riel <riel@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	George Spelvin <linux@horizon.com>, Harvey Harrison <harvey.ha>
Subject: Re: [PATCH RFC 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
Date: Thu, 1 Aug 2013 22:47:10 +0200	[thread overview]
Message-ID: <20130801204710.GH27162@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <51FAC3BA.9050705@linux.vnet.ibm.com>

On Fri, Aug 02, 2013 at 01:53:22AM +0530, Raghavendra K T wrote:

You need to learn to trim your replies.. I already stopped reading that
paravirt thread because of it. Soon I'll introduce you to my /dev/null
mail reader.

> On 08/01/2013 08:07 AM, Waiman Long wrote:
> >+static __always_inline void queue_spin_lock(struct qspinlock *lock)
> >+{
> >+	if (likely(queue_spin_trylock(lock)))
> >+		return;
> >+	queue_spin_lock_slowpath(lock);
> >+}
> 
> quickly falling into slowpath may hurt performance in some cases. no?
> 
> Instead, I tried something like this:
> 
> #define SPIN_THRESHOLD 64
> 
> static __always_inline void queue_spin_lock(struct qspinlock *lock)
> {
>         unsigned count = SPIN_THRESHOLD;
>         do {
>                 if (likely(queue_spin_trylock(lock)))
>                         return;
>                 cpu_relax();
>         } while (count--);
>         queue_spin_lock_slowpath(lock);
> }
> 
> Though I could see some gains in overcommit, but it hurted undercommit
> in some workloads :(.

This would break the FIFO nature of the lock.

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Waiman Long <Waiman.Long@hp.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Richard Weinberger <richard@nod.at>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matt Fleming <matt.fleming@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Akinobu Mita <akinobu.mita@gmail.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Michel Lespinasse <walken@google.com>,
	Andi Kleen <andi@firstfloor.org>, Rik van Riel <riel@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	George Spelvin <linux@horizon.com>,
	Harvey Harrison <harvey.harrison@gmail.com>,
	"Chandramouleeswaran, Aswin" <aswin@hp.com>,
	"Norton, Scott J" <scott.norton@hp.com>
Subject: Re: [PATCH RFC 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation
Date: Thu, 1 Aug 2013 22:47:10 +0200	[thread overview]
Message-ID: <20130801204710.GH27162@twins.programming.kicks-ass.net> (raw)
Message-ID: <20130801204710.j3zQ8IoYpwD_w7rlxogQjlbcCUf-6nxdJXRgaxKeohY@z> (raw)
In-Reply-To: <51FAC3BA.9050705@linux.vnet.ibm.com>

On Fri, Aug 02, 2013 at 01:53:22AM +0530, Raghavendra K T wrote:

You need to learn to trim your replies.. I already stopped reading that
paravirt thread because of it. Soon I'll introduce you to my /dev/null
mail reader.

> On 08/01/2013 08:07 AM, Waiman Long wrote:
> >+static __always_inline void queue_spin_lock(struct qspinlock *lock)
> >+{
> >+	if (likely(queue_spin_trylock(lock)))
> >+		return;
> >+	queue_spin_lock_slowpath(lock);
> >+}
> 
> quickly falling into slowpath may hurt performance in some cases. no?
> 
> Instead, I tried something like this:
> 
> #define SPIN_THRESHOLD 64
> 
> static __always_inline void queue_spin_lock(struct qspinlock *lock)
> {
>         unsigned count = SPIN_THRESHOLD;
>         do {
>                 if (likely(queue_spin_trylock(lock)))
>                         return;
>                 cpu_relax();
>         } while (count--);
>         queue_spin_lock_slowpath(lock);
> }
> 
> Though I could see some gains in overcommit, but it hurted undercommit
> in some workloads :(.

This would break the FIFO nature of the lock.


  parent reply	other threads:[~2013-08-01 20:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1375324631-32868-1-git-send-email-Waiman.Long@hp.com>
2013-08-01  2:37 ` [PATCH RFC 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
2013-08-01  2:37   ` Waiman Long
     [not found]   ` <20130801094029.GK3008@twins.programming.kicks-ass.net>
2013-08-01 10:11     ` Raghavendra K T
2013-08-01 10:11       ` Raghavendra K T
2013-08-01 10:12       ` Peter Zijlstra
2013-08-01 10:12         ` Peter Zijlstra
2013-08-01 10:14       ` Peter Zijlstra
2013-08-01 10:14         ` Peter Zijlstra
     [not found]     ` <51FAA1C3.2050507@hp.com>
2013-08-01 18:16       ` Raghavendra K T
2013-08-01 18:16         ` Raghavendra K T
2013-08-01 20:10         ` Peter Zijlstra
2013-08-01 20:10           ` Peter Zijlstra
2013-08-01 20:36           ` Raghavendra K T
2013-08-01 20:36             ` Raghavendra K T
2013-08-01 20:23   ` Raghavendra K T
2013-08-01 20:23     ` Raghavendra K T
2013-08-01 20:47     ` Peter Zijlstra [this message]
2013-08-01 20:47       ` Peter Zijlstra
2013-08-02  2:54       ` Raghavendra K T
2013-08-02  2:54         ` Raghavendra K T
2013-08-01 21:09     ` Waiman Long
2013-08-01 21:09       ` Waiman Long
2013-08-02  3:00       ` Raghavendra K T
2013-08-02  3:00         ` Raghavendra K T
2013-08-01  2:37 ` [PATCH RFC 2/2] qspinlock x86: Enable x86 to use queue spinlock Waiman Long
2013-08-01  2:37   ` 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=20130801204710.GH27162@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Waiman.Long@hp.com \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=matt.fleming@intel.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=richard@nod.at \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.com \
    --cc=x86@kernel.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