On Sat, Nov 16, 2013 at 11:58:45AM +0000, David Howells wrote:
> Paul E. McKenney <[email protected]> wrote:
> 
> > -           /* read index before reading contents at that index */
> 
> > -           smp_mb(); /* finish reading descriptor before incrementing tail 
> > */
> 
> I'd rather you didn't remove these comments (assuming they're correct) as
> they're pointing out the point of the example.

Ah, good point!  I have added them back just before the smp_load_acquire()
and smp_store_release(), as shown below.  Does that work?

                                                        Thanx, Paul

------------------------------------------------------------------------

diff --git a/Documentation/circular-buffers.txt 
b/Documentation/circular-buffers.txt
index 15e54ff50018..88951b179262 100644
--- a/Documentation/circular-buffers.txt
+++ b/Documentation/circular-buffers.txt
@@ -200,6 +200,7 @@ The consumer will look something like this:
 
        spin_lock(&consumer_lock);
 
+       /* Read index before reading contents at that index. */
        unsigned long head = smp_load_acquire(buffer->head);
        unsigned long tail = buffer->tail;
 
@@ -210,6 +211,7 @@ The consumer will look something like this:
 
                consume_item(item);
 
+               /* Finish reading descriptor before incrementing tail. */
                smp_store_release(buffer->tail,
                                  (tail + 1) & (buffer->size - 1));
        }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to