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>
Subject: Re: [PATCH 10/11] ring-buffer: move big if statement down
Date: Wed, 6 May 2009 16:37:55 +0200 [thread overview]
Message-ID: <20090506143755.GB29044@elte.hu> (raw)
In-Reply-To: <alpine.DEB.2.00.0905060930190.3239@gandalf.stny.rr.com>
* Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 6 May 2009, Ingo Molnar wrote:
>
> >
> > * Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > > This patch changes it to a goto:
> > >
> > > code;
> > >
> > > if (cross to next page)
> > > goto next_page;
> > >
> > > more code;
> > >
> > > return;
> > >
> > > next_page:
> > >
> > > [ lots of code]
> >
> > I have pulled it, but could you please change it to a helper
> > function instead? There's almost never a good reason to combine
> > 'more code' with 'lots of code' in a single function. It also
> > documents the unlikeliness, etc.
>
> As I stated in the change log, I did not want to convert it to a helper
> function because it uses the variables created before. It would end up
> going from:
>
> if (write > BUF_PAGE_SIZE)
> goto next_page;
>
>
> to:
>
> if (write > BUF_PAGE_SIZE)
> return rb_move_tail(cpu_buffer, length, tail,
> commit_page, tail_page);
>
>
> Although it is the "unlikely" case, it is still a fast path. It
> happens every time a write into the page buffer crosses a page
> boundary. Since it is only used once, gcc would hopefully inline
> it. If it does not, then we are copying a bunch of parameters for
> nothing.
>
> I could still do this and see what gcc does with it.
GCC might make a mess of it - but parameters shouldnt be copied
normally (on 64-bit at least), they'll just be held in parameter
registers.
Ingo
next prev parent reply other threads:[~2009-05-06 14:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-06 4:21 [PATCH 00/11] [GIT PULL] tracing/ring-buffer: various updates Steven Rostedt
2009-05-06 4:21 ` [PATCH 01/11] ring-buffer: export symbols Steven Rostedt
2009-05-06 4:21 ` [PATCH 02/11] ring-buffer: add counters for commit overrun and nmi dropped entries Steven Rostedt
2009-05-06 4:21 ` [PATCH 03/11] tracing: export stats of ring buffers to userspace Steven Rostedt
2009-05-06 8:28 ` Ingo Molnar
2009-05-06 10:23 ` Frédéric Weisbecker
2009-05-06 4:21 ` [PATCH 04/11] ring-buffer: convert cpu buffer entries to local_t Steven Rostedt
2009-05-06 4:21 ` [PATCH 05/11] ring-buffer: record page entries in buffer page descriptor Steven Rostedt
2009-05-06 4:21 ` [PATCH 06/11] ring-buffer: have read page swap increment counter with page entries Steven Rostedt
2009-05-06 4:21 ` [PATCH 07/11] ring-buffer: disable writers when resetting buffers Steven Rostedt
2009-05-06 4:21 ` [PATCH 08/11] ftrace: use .sched.text, not .text.sched in recordmcount.pl Steven Rostedt
2009-05-06 4:21 ` [PATCH 09/11] tracing: use proper export symbol for tracing api Steven Rostedt
2009-05-06 4:21 ` [PATCH 10/11] ring-buffer: move big if statement down Steven Rostedt
2009-05-06 8:24 ` Ingo Molnar
2009-05-06 13:47 ` Steven Rostedt
2009-05-06 14:37 ` Ingo Molnar [this message]
2009-05-06 4:21 ` [PATCH 11/11] ring-buffer: add benchmark and tester Steven Rostedt
2009-05-06 8:53 ` Ingo Molnar
2009-05-06 14:02 ` Steven Rostedt
2009-05-06 19:43 ` Steven Rostedt
2009-05-06 20:58 ` Ingo Molnar
2009-05-06 8:28 ` [PATCH 00/11] [GIT PULL] tracing/ring-buffer: various updates Ingo Molnar
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=20090506143755.GB29044@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®