ring-buffer: Make rb_reserve_next_event() always inlined
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Wed, 23 Nov 2016 16:36:30 +0000 (11:36 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 23 Nov 2016 16:36:30 +0000 (11:36 -0500)
The function rb_reserved_next_event() is called by two functions:
ring_buffer_lock_reserve() and ring_buffer_write(). This is in a very hot
path of the tracing code, and it is best that they are not functions. The
two callers are basically wrapers for rb_reserver_next_event(). Removing the
function calls can save execution time in the hotpath of tracing.

Link: http://lkml.kernel.org/r/20161121183700.GW26852@two.firstfloor.org
Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ring_buffer.c

index 9c143739b8d73f0c7982be06eb0e5cdb902bfc81..1f3580cee6cc771b532dd6897b33e89906c8861f 100644 (file)
@@ -2733,7 +2733,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
        return event;
 }
 
-static struct ring_buffer_event *
+static __always_inline struct ring_buffer_event *
 rb_reserve_next_event(struct ring_buffer *buffer,
                      struct ring_buffer_per_cpu *cpu_buffer,
                      unsigned long length)