mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 06:32:08 +00:00
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>
This commit is contained in:
parent
be957c447f
commit
0f0c85fc80
1 changed files with 6 additions and 6 deletions
|
@ -1000,7 +1000,7 @@ rb_event_index(struct ring_buffer_event *event)
|
||||||
return (addr & ~PAGE_MASK) - (PAGE_SIZE - BUF_PAGE_SIZE);
|
return (addr & ~PAGE_MASK) - (PAGE_SIZE - BUF_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static inline int
|
||||||
rb_is_commit(struct ring_buffer_per_cpu *cpu_buffer,
|
rb_is_commit(struct ring_buffer_per_cpu *cpu_buffer,
|
||||||
struct ring_buffer_event *event)
|
struct ring_buffer_event *event)
|
||||||
{
|
{
|
||||||
|
@ -1423,9 +1423,9 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer,
|
||||||
* also be made. But only the entry that did the actual
|
* also be made. But only the entry that did the actual
|
||||||
* commit will be something other than zero.
|
* commit will be something other than zero.
|
||||||
*/
|
*/
|
||||||
if (cpu_buffer->tail_page == cpu_buffer->commit_page &&
|
if (likely(cpu_buffer->tail_page == cpu_buffer->commit_page &&
|
||||||
rb_page_write(cpu_buffer->tail_page) ==
|
rb_page_write(cpu_buffer->tail_page) ==
|
||||||
rb_commit_index(cpu_buffer)) {
|
rb_commit_index(cpu_buffer))) {
|
||||||
|
|
||||||
delta = ts - cpu_buffer->write_stamp;
|
delta = ts - cpu_buffer->write_stamp;
|
||||||
|
|
||||||
|
@ -1436,7 +1436,7 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer,
|
||||||
if (unlikely(ts < cpu_buffer->write_stamp))
|
if (unlikely(ts < cpu_buffer->write_stamp))
|
||||||
delta = 0;
|
delta = 0;
|
||||||
|
|
||||||
if (test_time_stamp(delta)) {
|
else if (unlikely(test_time_stamp(delta))) {
|
||||||
|
|
||||||
commit = rb_add_time_stamp(cpu_buffer, &ts, &delta);
|
commit = rb_add_time_stamp(cpu_buffer, &ts, &delta);
|
||||||
|
|
||||||
|
@ -1470,7 +1470,7 @@ rb_reserve_next_event(struct ring_buffer_per_cpu *cpu_buffer,
|
||||||
* If the timestamp was commited, make the commit our entry
|
* If the timestamp was commited, make the commit our entry
|
||||||
* now so that we will update it when needed.
|
* now so that we will update it when needed.
|
||||||
*/
|
*/
|
||||||
if (commit)
|
if (unlikely(commit))
|
||||||
rb_set_commit_event(cpu_buffer, event);
|
rb_set_commit_event(cpu_buffer, event);
|
||||||
else if (!rb_is_commit(cpu_buffer, event))
|
else if (!rb_is_commit(cpu_buffer, event))
|
||||||
delta = 0;
|
delta = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue