From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Li Zefan <lizf@cn.fujitsu.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 3/7] ring-buffer: make moving the tail page a separate function
Date: Thu, 7 May 2009 15:56:45 +0200 [thread overview]
Message-ID: <20090507135645.GC481@elte.hu> (raw)
In-Reply-To: <alpine.DEB.2.00.0905070924250.32734@gandalf.stny.rr.com>
* Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Thu, 7 May 2009, Ingo Molnar wrote:
>
> >
> > * Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > +static struct ring_buffer_event *
> > > +__rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
> > > + unsigned type, unsigned long length, u64 *ts)
> > > +{
> > > + struct buffer_page *tail_page, *commit_page;
> > > + struct ring_buffer_event *event;
> > > + unsigned long tail, write;
> > > +
> > > + commit_page = cpu_buffer->commit_page;
> > > + /* we just need to protect against interrupts */
> > > + barrier();
> > > + tail_page = cpu_buffer->tail_page;
> > > + write = local_add_return(length, &tail_page->write);
> > > + tail = write - length;
> > > +
> > > + /* See if we shot pass the end of this buffer page */
> > > + if (write > BUF_PAGE_SIZE)
> > > + return rb_move_tail(cpu_buffer, length, tail,
> > > + commit_page, tail_page, ts);
> >
> > Nice! The __rb_reserve_next() fast-path logic became a lot clearer.
>
> Thanks!
>
> >
> > The above branch might be unlikely(), right? With usual record sizes
> > of around 40 bytes, we'll have a 100 records for every page
> > overflow. That's i think within the reach of unlikely().
> >
> > Depends on how much of a mess GCC makes of it though.
>
> I looked at the assembly that gcc generates, and it is fine. gcc
> inlines the function and puts it at the end, thus it already
> treats it as an unlikely. I would like to avoid adding unlikely
> annotations when possible.
Fair enough!
Ingo
next prev parent reply other threads:[~2009-05-07 14:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 3:13 [PATCH 0/7] [GIT PULL] tracing/ring-buffer: more updates for tip Steven Rostedt
2009-05-07 3:13 ` [PATCH 1/7] ring-buffer: remove unneeded conditional in rb_reserve_next Steven Rostedt
2009-05-07 8:23 ` Ingo Molnar
2009-05-07 3:13 ` [PATCH 2/7] ring-buffer: check for failed allocation in ring buffer benchmark Steven Rostedt
2009-05-07 3:13 ` [PATCH 3/7] ring-buffer: make moving the tail page a separate function Steven Rostedt
2009-05-07 8:27 ` Ingo Molnar
2009-05-07 13:26 ` Steven Rostedt
2009-05-07 13:56 ` Ingo Molnar [this message]
2009-05-07 3:13 ` [PATCH 4/7] ring-buffer: change test to be more latency friendly Steven Rostedt
2009-05-07 8:31 ` Ingo Molnar
2009-05-07 8:34 ` Ingo Molnar
2009-05-07 13:51 ` Steven Rostedt
2009-05-07 3:13 ` [PATCH 5/7] tracing: update sample with TRACE_INCLUDE_FILE Steven Rostedt
2009-05-07 3:13 ` [PATCH 6/7] tracing: reset ring buffer when removing modules with events Steven Rostedt
2009-05-07 3:51 ` Li Zefan
2009-05-07 16:24 ` Frederic Weisbecker
2009-05-07 3:13 ` [PATCH 7/7] tracing: add hierarchical enabling of events Steven Rostedt
2009-05-07 3:51 ` Li Zefan
2009-05-07 13:21 ` Steven Rostedt
2009-05-08 1:11 ` Li Zefan
2009-05-08 1:23 ` Steven Rostedt
2009-05-08 1:24 ` Steven Rostedt
2009-05-07 16:28 ` Frederic Weisbecker
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=20090507135645.GC481@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox