public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Pranith Kumar <bobby.prani@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	David Howells <dhowells@redhat.com>,
	Masanari Iida <standby24x7@gmail.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] doc: memory-barriers.txt: Add barrier() to provide ordering
Date: Wed, 13 Aug 2014 15:50:17 -0700	[thread overview]
Message-ID: <20140813225017.GD4752@linux.vnet.ibm.com> (raw)
In-Reply-To: <1407797503-24727-2-git-send-email-bobby.prani@gmail.com>

On Mon, Aug 11, 2014 at 06:51:40PM -0400, Pranith Kumar wrote:
> In the provably false case, add barrier() in both the legs of the if() condition
> to provide ordering.
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> ---
>  Documentation/memory-barriers.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
> index 41a6c9c..0f2903f 100644
> --- a/Documentation/memory-barriers.txt
> +++ b/Documentation/memory-barriers.txt
> @@ -689,9 +689,11 @@ should do something like the following:
>  	q = ACCESS_ONCE(a);
>  	BUILD_BUG_ON(MAX <= 1); /* Order load from a with store to b. */
>  	if (q % MAX) {
> +		barrier();
>  		ACCESS_ONCE(b) = p;
>  		do_something();
>  	} else {
> +		barrier();
>  		ACCESS_ONCE(b) = p;
>  		do_something_else();
>  	}

This section had to be rewritten due to -O3.

							Thanx, Paul


  reply	other threads:[~2014-08-13 22:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 22:51 [PATCH] doc: memory-barriers.txt: Minor correction in Control dependencies Pranith Kumar
2014-08-11 22:51 ` [PATCH] doc: memory-barriers.txt: Add barrier() to provide ordering Pranith Kumar
2014-08-13 22:50   ` Paul E. McKenney [this message]
2014-08-11 22:51 ` [PATCH] sched: Remove ACCESS_ONCE() for jiffies Pranith Kumar
2014-08-12  5:55   ` Peter Zijlstra
2014-08-12 14:42     ` Pranith Kumar
2014-08-12 22:11       ` David Rientjes
2014-08-11 22:51 ` [PATCH] compiler.h: Move __memory_barrier() use to compiler-intel.h Pranith Kumar
2014-08-13 22:49 ` [PATCH] doc: memory-barriers.txt: Minor correction in Control dependencies Paul E. McKenney

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=20140813225017.GD4752@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=bobby.prani@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=standby24x7@gmail.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