public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Michael Breuer <mbreuer@majjas.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: x86 - cpu_relax - why nop vs. pause?
Date: Sun, 7 Feb 2010 19:09:49 +0100	[thread overview]
Message-ID: <20100207180949.GA26388@8bytes.org> (raw)
In-Reply-To: <4B6EF853.9090704@majjas.com>

On Sun, Feb 07, 2010 at 12:28:51PM -0500, Michael Breuer wrote:
> I did search and noticed some old discussions. Looking at both Intel and  
> AMD documentation, it would seem that PAUSE is the preferred instruction  
> within a spin lock. Further, both Intel and AMD specifications state  
> that the instruction is backward compatible with older x86 processors.

Its not the primary reason, but the hardware virtualization extensions
of x86 processors support an intercept after a configured amount of
pause instructions were executed. This is used to detect spinning vcpus
where the lock-holder is scheduled out.

> For fun, I changed nop to pause on my core i7 920 (smt enabled) and I'm  
> seeing about a 5-10% performance improvement on 2.6.33 rc7. Perf top  
> shows time spent in spin_lock under load drops from an average of around  
> 35% to about 25%.

What benchmarks have you used for your measurements?

	Joerg


  reply	other threads:[~2010-02-07 18:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-07 17:28 x86 - cpu_relax - why nop vs. pause? Michael Breuer
2010-02-07 18:09 ` Joerg Roedel [this message]
2010-02-07 18:32 ` Arjan van de Ven
     [not found] ` <1265566470.6280.10.camel@marge.simson.net>
2010-02-07 20:08   ` Michael Breuer
2010-02-07 21:15     ` Michael Breuer
2010-02-08  3:50       ` Michael Breuer
2010-02-08 13:33         ` Artur Skawina

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=20100207180949.GA26388@8bytes.org \
    --to=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbreuer@majjas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox