diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-05-06 03:16:11 +0200 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-05-06 03:16:11 +0200 |
commit | aa20ae8444fc6c318272c643f856d8d8ad3e198d (patch) | |
tree | 662d8f33c284a43a41d5c9e9edfe13238bd3535e /kernel/trace/Makefile | |
parent | tracing: use proper export symbol for tracing api (diff) | |
download | linux-aa20ae8444fc6c318272c643f856d8d8ad3e198d.tar.xz linux-aa20ae8444fc6c318272c643f856d8d8ad3e198d.zip |
ring-buffer: move big if statement down
In the hot path of the ring buffer "__rb_reserve_next" there's a big
if statement that does not even return back to the work flow.
code;
if (cross to next page) {
[ lots of code ]
return;
}
more code;
The condition is even the unlikely path, although we do not denote it
with an unlikely because gcc is fine with it. The condition is true when
the write crosses a page boundary, and we need to start at a new page.
Having this if statement makes it hard to read, but calling another
function to do the work is also not appropriate, because we are using a lot
of variables that were set before the if statement, and we do not want to
send them as parameters.
This patch changes it to a goto:
code;
if (cross to next page)
goto next_page;
more code;
return;
next_page:
[ lots of code]
This makes the code easier to understand, and a bit more obvious.
The output from gcc is practically identical. For some reason, gcc decided
to use different registers when I switched it to a goto. But other than that,
the logic is the same.
[ Impact: easier to read code ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/Makefile')
0 files changed, 0 insertions, 0 deletions