lkml.org 
[lkml]   [2014]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] doc: memory-barriers.txt: Add barrier() to provide ordering
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



\
 
 \ /
  Last update: 2014-08-14 01:01    [W:0.080 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site