Re: [PATCH] Document Linux's circular buffering capabilities

From: David Howells
Date: Mon Mar 15 2010 - 08:36:33 EST


Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/