All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Re: volatile and atomic_t/spinlock_t
Date: Wed, 6 Jun 2007 00:17:36 +0200	[thread overview]
Message-ID: <20070605221736.GA9315@osiris.ibm.com> (raw)
In-Reply-To: <617E1C2C70743745A92448908E030B2A019DD5B5@scsmsx411.amr.corp.intel.com>

On Tue, Jun 05, 2007 at 11:38:27AM -0700, Luck, Tony wrote:
> > So is
> >
> >	while (__raw_spin_is_locked(&v));
> >
> > supposed to work? Or should that be 
> >
> >	while (__raw_spin_is_locked(&v))
> >		cpu_relax();
> >
> > as well and all the volatiles can/should go away?
> 
> cpu_relax() is a really good idea in every spinloop on
> hyper-threaded cores.  It lets the h/w know that we aren't
> doing anything useful here, so resources and power can be
> diverted to other threads sharing the core.
> 
> Avoiding the need for volatile or other compiler optimizer
> defeating tricks is a side benefit.

Currently it is already that it has to be

	while (__raw_spin_is_locked(&v))
		cpu_relax();

Just like in __raw_spin_unlock_wait(). Oh well, I should have
checked more before posting...

      reply	other threads:[~2007-06-05 22:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-05 11:48 volatile and atomic_t/spinlock_t Heiko Carstens
2007-06-05 18:38 ` Luck, Tony
2007-06-05 18:38   ` Luck, Tony
2007-06-05 22:17   ` Heiko Carstens [this message]

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=20070605221736.GA9315@osiris.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.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.