diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-05-11 16:08:00 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-05-11 23:12:34 -0400 |
commit | 0f0c85fc80adbbd2265d89867d743f929d516805 (patch) | |
tree | 0095c5a83727863eb38027c41b9a0cd74c1d283d /kernel/trace/ring_buffer.c | |
parent | be957c447f7233a67904a1b11eb3ab61e702bf4d (diff) |
ring-buffer: small optimizations
Doing some small changes in the fast path of the ring buffer recording
saves over 3% in the ring-buffer-benchmark test.
[ Impact: a little faster ring buffer recording ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r-- | kernel/trace/ring_buffer.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 493cba46abc9..f452de2ce490 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -1000,7 +1000,7 @@ rb_event_index(struct ring_buffer_event *event) | |||
1000 | return (addr & ~PAGE_MASK) - (PAGE_SIZE - BUF_PAGE_SIZE); | 1000 | return (addr & ~PAGE_MASK) - (PAGE_SIZE - BUF_PAGE_SIZE); |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | static int | 1003 | static inline int |
1004 | rb_is_commit(struct ring_buffer_per_cpu *cpu_buffer, | 1004 | rb_is_commit(struct ring_buffer_per_cpu *cpu_buffer, |
1005 | struct ring_buffer_event *event) | 1005 | struct ring_buffer_event *event) |
1006 | { | 1006 | { |
@@ -1423,9 +1423,9 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer, | |||
1423 | * also be made. But only the entry that did the actual | 1423 | * also be made. But only the entry that did the actual |
1424 | * commit will be something other than zero. | 1424 | * commit will be something other than zero. |
1425 | */ | 1425 | */ |
1426 | if (cpu_buffer->tail_page == cpu_buffer->commit_page && | 1426 | if (likely(cpu_buffer->tail_page == cpu_buffer->commit_page && |
1427 | rb_page_write(cpu_buffer->tail_page) == | 1427 | rb_page_write(cpu_buffer->tail_page) == |
1428 | rb_commit_index(cpu_buffer)) { | 1428 | rb_commit_index(cpu_buffer))) { |
1429 | 1429 | ||
1430 | delta = ts - cpu_buffer->write_stamp; | 1430 | delta = ts - cpu_buffer->write_stamp; |
1431 | 1431 | ||
@@ -1436,7 +1436,7 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer, | |||
1436 | if (unlikely(ts < cpu_buffer->write_stamp)) | 1436 | if (unlikely(ts < cpu_buffer->write_stamp)) |
1437 | delta = 0; | 1437 | delta = 0; |
1438 | 1438 | ||
1439 | if (test_time_stamp(delta)) { | 1439 | else if (unlikely(test_time_stamp(delta))) { |
1440 | 1440 | ||
1441 | commit = rb_add_time_stamp(cpu_buffer, &ts, &delta); | 1441 | commit = rb_add_time_stamp(cpu_buffer, &ts, &delta); |
1442 | 1442 | ||
@@ -1470,7 +1470,7 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer, | |||
1470 | * If the timestamp was commited, make the commit our entry | 1470 | * If the timestamp was commited, make the commit our entry |
1471 | * now so that we will update it when needed. | 1471 | * now so that we will update it when needed. |
1472 | */ | 1472 | */ |
1473 | if (commit) | 1473 | if (unlikely(commit)) |
1474 | rb_set_commit_event(cpu_buffer, event); | 1474 | rb_set_commit_event(cpu_buffer, event); |
1475 | else if (!rb_is_commit(cpu_buffer, event)) | 1475 | else if (!rb_is_commit(cpu_buffer, event)) |
1476 | delta = 0; | 1476 | delta = 0; |