mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Matthias Hahn <pmhahn@titan.lahn.de>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] "volatile considered harmful", take 2
Date: Fri, 11 May 2007 09:41:26 +0200	[thread overview]
Message-ID: <20070511074126.GA3037@titan.lahn.de> (raw)
In-Reply-To: <6143.1178828419@lwn.net>

Hello!

On Thu, May 10, 2007 at 02:20:19PM -0600, Jonathan Corbet wrote:
...
> +++ b/Documentation/volatile-considered-harmful.txt
...
> +Consider a typical block of kernel code:
> +
> +    spin_lock(&the_lock);
> +    do_something_on(&shared_data);
                        ^^^^^^^^^^^
> +    do_something_else_with(&shared_data);
                               ^^^^^^^^^^^
> +    spin_unlock(&the_lock);
> +
> +If all the code follows the locking rules, the value of shared_data cannot
> +change unexpectedly while the_lock is held.  Any other code which might
> +want to play with that data will be waiting on the lock.  The spinlock
> +primitives act as memory barriers - they are explicitly written to do so -
> +meaning that data accesses will not be optimized across them.  So the
> +compiler might think it knows what will be in some_data, but the
s/some_data/shared_data/ ?                       ^^^^^^^^^

BYtE
Philipp
-- 
  / /  (_)__  __ ____  __ Philipp Hahn
 / /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\ pmhahn@titan.lahn.de

  parent reply	other threads:[~2007-05-11  8:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-10 20:20 Jonathan Corbet
2007-05-10 20:38 ` jimmy bahuleyan
2007-05-10 21:44   ` Satyam Sharma
2007-05-11 12:21   ` Johannes Stezenbach
2007-05-11 13:52     ` jimmy bahuleyan
2007-05-11 14:21     ` Satyam Sharma
2007-05-10 21:34 ` Jan Engelhardt
2007-05-10 21:45   ` H. Peter Anvin
2007-05-11 21:33     ` Jan Engelhardt
2007-05-11 21:47       ` H. Peter Anvin
     [not found]         ` <64026d4a0705112157p75d76956g40455c7402b096d6@mail.gmail.com>
2007-05-12  5:32           ` H. Peter Anvin
2007-05-11  7:41 ` Philipp Matthias Hahn [this message]
2007-05-11  8:41 ` Bernd Eckenfels
2007-05-11 11:17 ` Stefan Richter

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=20070511074126.GA3037@titan.lahn.de \
    --to=pmhahn@titan.lahn.de \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®