lkml.org 
[lkml]   [2010]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Document Linux's circular buffering capabilities
Date
Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:

> Would you agree to add a quick note that these examples are simple
> enough to not strictly require ACCESS_ONCE but are meant to show what
> more general code would have to do? Else a reader might be left puzzled
> why he can't see in the example code the circumstances which require
> ACCESS_ONCE and may remain unsure about where to use it in his own works...

How about adding a bit:

Note the use of ACCESS_ONCE() in both algorithms to read the opposition index.
This prevents the compiler from discarding and reloading its cached value -
-which some compilers will do across smp_read_barrier_depends().
+which some compilers will do across smp_read_barrier_depends(). This isn't
+strictly needed if you can be sure that the opposition index will _only_ be
+used the once.

David


\
 
 \ /
  Last update: 2010-03-15 13:39    [W:0.060 / U:56.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site