[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131116154032.GC4138@linux.vnet.ibm.com>
Date: Sat, 16 Nov 2013 07:40:32 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org,
laijs@...fujitsu.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
josh@...htriplett.org, niv@...ibm.com, tglx@...utronix.de,
peterz@...radead.org, rostedt@...dmis.org, edumazet@...gle.com,
darren@...art.com, fweisbec@...il.com, sbw@....edu
Subject: Re: [PATCH tip/core/rcu 4/4] documentation: Update circular buffer
for load-acquire/store-release
On Sat, Nov 16, 2013 at 11:58:45AM +0000, David Howells wrote:
> Paul E. McKenney <paulmck@...ux.vnet.ibm.com> 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists