All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: David Miller <davem@davemloft.net>,
	torvalds@linux-foundation.org, anton@samba.org,
	akpm@linux-foundation.org, willy@linux.intel.com,
	benh@kernel.crashing.org, paulus@samba.org,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2]: atomic_t: Remove volatile from atomic_t definition
Date: Fri, 21 May 2010 15:27:46 +1000	[thread overview]
Message-ID: <20100521052746.GL2516@laptop> (raw)
In-Reply-To: <20100519225046.GO2237@linux.vnet.ibm.com>

On Wed, May 19, 2010 at 03:50:46PM -0700, Paul E. McKenney wrote:
> On Wed, May 19, 2010 at 12:54:49PM -0700, David Miller wrote:
> > From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > Date: Wed, 19 May 2010 08:01:32 -0700
> > 
> > > On Wed, May 19, 2010 at 11:03:27PM +1000, Nick Piggin wrote:
> > >> For atomic_read it shouldn't matter unless gcc is *really* bad at it.
> > >> Ah, for atomic_read, the required semantic is surely ACCESS_ONCE, so
> > >> that's where the volatile is needed? (maybe it would be clearer to
> > >> explicitly use ACCESS_ONCE?)
> > > 
> > > Explicit use of ACCESS_ONCE() where needed makes a lot of sense to me,
> > > and allows better code to be generated for initialization and cleanup
> > > code where no other task has access to the atomic_t.
> > 
> > I agree and I want to see this too, but I think with the tree the size
> > that it is we have to work backwards at this point.
> > 
> > Existing behavior by default, and optimized cases get tagged by using
> > a new interface (atomic_read_light(), test_bit{,s}_light(), etc.)
> 
> Fair enough!

Hmm, I'm missing something. David, back up a second, as far as I can see,
with Anton's patches, atomic_read() *is* effectively just ACCESS_ONCE()
now. Linus pointed out that header tangle is the reason not to just use
the macro.

Am I wrong, or is it that ACCESS_ONCE has a more relaxed semantic *in
theory* that allows a future more aggressive implementation if the
compiler supports it?

do {
    done = ACCESS_ONCE(blah);
} while (!done);

Is this (in theory) allowed to be turned into a branch into an infinite
loop? Wheras the volatile deref would require it be reloaded each time?

  reply	other threads:[~2010-05-21  5:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17  4:33 [PATCH 1/2]: atomic_t: Cast to volatile when accessing atomic variables Anton Blanchard
2010-05-17  4:34 ` [PATCH 2/2]: atomic_t: Remove volatile from atomic_t definition Anton Blanchard
2010-05-17  8:58   ` Heiko Carstens
2010-05-17 15:01   ` Linus Torvalds
2010-05-17 20:13     ` Jamie Lokier
2010-05-17 20:20       ` Linus Torvalds
2010-05-19 13:03     ` Nick Piggin
2010-05-19 14:55       ` Linus Torvalds
2010-05-19 15:01       ` Paul E. McKenney
2010-05-19 19:54         ` David Miller
2010-05-19 22:50           ` Paul E. McKenney
2010-05-21  5:27             ` Nick Piggin [this message]
2010-05-21  5:54               ` David Miller
2010-05-21  6:06                 ` Nick Piggin
2010-05-21  6:10                   ` David Miller
2010-05-21  6:44                     ` Eric Dumazet

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=20100521052746.GL2516@laptop \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@linux.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.