linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: <root@chaos.analogic.com>, "Roger Larsson" <roger.larsson@norran.net>
Cc: "Linux kernel" <linux-kernel@vger.kernel.org>
Subject: RE: SMP spin-locks
Date: Fri, 15 Jun 2001 03:35:21 -0700	[thread overview]
Message-ID: <NCBBLIEPOCNJOAEKBEAKGEDMPOAA.davids@webmaster.com> (raw)
In-Reply-To: <Pine.LNX.3.95.1010614223154.20486A-100000@chaos.analogic.com>


> Spinlocks are machine dependent. A simple increment of a byte
> memory variable, spinning if it's not 1 will do fine. Decrementing
> this variable will release the lock. A `lock` prefix is not necessary
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> because  all Intel byte operations are atomic anyway. This assumes
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> that the lock was initialized to 0. It doesn't have to be. It
> could be initialized to 0xaa (anything) and spin if it's not
> 0xab (or anything + 1).

	If this is true, atomicity isn't enough to do it. Atomicity means that
there's a single instruction (and so it can't be interrupted mid-modify).
Atomicity (at least as the term is normally used) doesn't prevent the
cache-coherency logic from ping-ponging the memory location between two
processor's caches during the atomic operation.

	DS


  parent reply	other threads:[~2001-06-15 10:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-14 17:26 SMP spin-locks Richard B. Johnson
2001-06-14 17:32 ` David S. Miller
2001-06-14 17:35 ` Kurt Garloff
2001-06-15  6:51   ` Doug Ledford
2001-06-14 20:42 ` Roger Larsson
2001-06-14 21:05   ` Richard B. Johnson
2001-06-14 21:30     ` Roger Larsson
2001-06-15  3:21       ` Richard B. Johnson
2001-06-15  2:33         ` David Lang
2001-06-15 10:35         ` David Schwartz [this message]
2001-06-15 13:26           ` Richard B. Johnson
2001-06-15 12:10     ` Ingo Oeser
2001-06-15 12:49       ` Richard B. Johnson
2001-06-15 15:52     ` Pavel Machek

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=NCBBLIEPOCNJOAEKBEAKGEDMPOAA.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.larsson@norran.net \
    --cc=root@chaos.analogic.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;
as well as URLs for NNTP newsgroup(s).