All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
	peterz@infradead.org, rostedt@goodmis.org, edumazet@google.com,
	darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu
Subject: Re: [PATCH tip/core/rcu 4/4] documentation: Update circular buffer for load-acquire/store-release
Date: Sat, 16 Nov 2013 07:40:32 -0800	[thread overview]
Message-ID: <20131116154032.GC4138@linux.vnet.ibm.com> (raw)
In-Reply-To: <13351.1384603125@warthog.procyon.org.uk>

On Sat, Nov 16, 2013 at 11:58:45AM +0000, David Howells wrote:
> Paul E. McKenney <paulmck@linux.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));
 	}


  reply	other threads:[~2013-11-16 15:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-16  0:10 [PATCH tip/core/rcu 0/4] Documentation changes for 3.14 Paul E. McKenney
2013-11-16  0:10 ` [PATCH tip/core/rcu 1/4] rcu: Fix typo in Documentation/RCU/trace.txt Paul E. McKenney
2013-11-16  0:10   ` [PATCH tip/core/rcu 2/4] rcu: Fix formatting blows in kernel-parameters.txt Paul E. McKenney
2013-11-16  0:10   ` [PATCH tip/core/rcu 3/4] documentation: Fix circular-buffer example Paul E. McKenney
2013-11-16  0:10   ` [PATCH tip/core/rcu 4/4] documentation: Update circular buffer for load-acquire/store-release Paul E. McKenney
2013-11-16 11:58     ` David Howells
2013-11-16 15:40       ` Paul E. McKenney [this message]
2013-11-16 16:03     ` Peter Zijlstra
2013-11-16 20:18       ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131116154032.GC4138@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=darren@dvhart.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=niv@us.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sbw@mit.edu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.