aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-05-05 21:16:11 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-05-05 21:16:11 -0400
commitaa20ae8444fc6c318272c643f856d8d8ad3e198d (patch)
tree662d8f33c284a43a41d5c9e9edfe13238bd3535e /kernel/printk.c
parent94487d6d53af5acae10cf9fd52f74498994d46b1 (diff)
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/printk.c')
0 files changed, 0 insertions, 0 deletions