All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: will.deacon@arm.com, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, paulus@samba.org,
	rostedt@goodmis.org
Subject: Re: perf_mmap__write_tail() and control dependencies
Date: Fri, 24 Jul 2015 17:35:45 +0200	[thread overview]
Message-ID: <20150724153545.GN18673@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150724153316.GL19282@twins.programming.kicks-ass.net>

On Fri, Jul 24, 2015 at 05:33:16PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 24, 2015 at 08:29:05AM -0700, Paul E. McKenney wrote:
> > Hello, Peter,
> > 
> > The ring-buffer code uses control dependencies, and the shiny new
> > READ_ONCE_CTRL() is now in mainline.  I was idly curious about whether
> > the write side could use smp_store_release(), and I found this:
> > 
> > static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail)
> > {
> > 	struct perf_event_mmap_page *pc = md->base;
> > 
> > 	/*
> > 	 * ensure all reads are done before we write the tail out.
> > 	 */
> > 	mb();
> > 	pc->data_tail = tail;
> > }
> > 
> > I see mb() rather than smp_mb().  Did I find the correct code for the
> > write side?  If so, why mb() rather than smp_mb()?  To serialize against
> > MMIO interactions with hardware counters or some such?
> 
> This is userspace, it doesn't patch itself depending on if its run on an
> SMP machine or not.

Furthremore, reading the buffer is a much less frequent occurrence than
writing entries to it. So its less performance critical.

  reply	other threads:[~2015-07-24 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 15:29 perf_mmap__write_tail() and control dependencies Paul E. McKenney
2015-07-24 15:33 ` Peter Zijlstra
2015-07-24 15:35   ` Peter Zijlstra [this message]
2015-07-24 15:36   ` Will Deacon
2015-07-24 15:49     ` 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=20150724153545.GN18673@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=will.deacon@arm.com \
    /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.