Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1532403

[for-next][PATCH 6/8] ring-buffer: Force inline of hotpath helper functions

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject [for-next][PATCH 6/8] ring-buffer: Force inline of hotpath helper functions
Date 2016-11-29 16:20 +0100
Message-ID <sISmm-1He-11@gated-at.bofh.it> (permalink)
References <sIScF-1DN-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

There's several small helper functions in ring_buffer.c that are used in the
hot path. For some reason, even though they are marked inline, gcc tends not
to enforce it. Make sure these functions are always inlined.

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 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 2760aaca6d1b..04068c0ed927 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1829,48 +1829,48 @@ void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val)
 }
 EXPORT_SYMBOL_GPL(ring_buffer_change_overwrite);
 
-static inline void *
+static __always_inline void *
 __rb_data_page_index(struct buffer_data_page *bpage, unsigned index)
 {
 	return bpage->data + index;
 }
 
-static inline void *__rb_page_index(struct buffer_page *bpage, unsigned index)
+static __always_inline void *__rb_page_index(struct buffer_page *bpage, unsigned index)
 {
 	return bpage->page->data + index;
 }
 
-static inline struct ring_buffer_event *
+static __always_inline struct ring_buffer_event *
 rb_reader_event(struct ring_buffer_per_cpu *cpu_buffer)
 {
 	return __rb_page_index(cpu_buffer->reader_page,
 			       cpu_buffer->reader_page->read);
 }
 
-static inline struct ring_buffer_event *
+static __always_inline struct ring_buffer_event *
 rb_iter_head_event(struct ring_buffer_iter *iter)
 {
 	return __rb_page_index(iter->head_page, iter->head);
 }
 
-static inline unsigned rb_page_commit(struct buffer_page *bpage)
+static __always_inline unsigned rb_page_commit(struct buffer_page *bpage)
 {
 	return local_read(&bpage->page->commit);
 }
 
 /* Size is determined by what has been committed */
-static inline unsigned rb_page_size(struct buffer_page *bpage)
+static __always_inline unsigned rb_page_size(struct buffer_page *bpage)
 {
 	return rb_page_commit(bpage);
 }
 
-static inline unsigned
+static __always_inline unsigned
 rb_commit_index(struct ring_buffer_per_cpu *cpu_buffer)
 {
 	return rb_page_commit(cpu_buffer->commit_page);
 }
 
-static inline unsigned
+static __always_inline unsigned
 rb_event_index(struct ring_buffer_event *event)
 {
 	unsigned long addr = (unsigned long)event;
-- 
2.10.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[for-next][PATCH 0/8] tracing: Some micro optimizations Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:20 +0100
  [for-next][PATCH 6/8] ring-buffer: Force inline of hotpath helper functions Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:20 +0100
  [for-next][PATCH 3/8] ring-buffer: Always inline rb_event_data() Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:20 +0100
  [for-next][PATCH 5/8] tracing: Make __buffer_unlock_commit() always_inline Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:20 +0100
  [for-next][PATCH 2/8] ring-buffer: Make rb_reserve_next_event() always inlined Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:20 +0100

csiph-web