[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0905060930190.3239@gandalf.stny.rr.com>
Date: Wed, 6 May 2009 09:47:34 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Ingo Molnar <mingo@...e.hu>
cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH 10/11] ring-buffer: move big if statement down
On Wed, 6 May 2009, Ingo Molnar wrote:
>
> * Steven Rostedt <rostedt@...dmis.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.
-- Steve
--
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