From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH v2 1/8] ring-buffer: Make write slow path out of line
Date: Wed, 20 Oct 2010 21:39:07 -0400 [thread overview]
Message-ID: <20101021014142.692298333@goodmis.org> (raw)
In-Reply-To: 20101021013906.507064528@goodmis.org
[-- Attachment #1: 0001-ring-buffer-Make-write-slow-path-out-of-line.patch --]
[-- Type: text/plain, Size: 1427 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Gcc inlines the slow path of the ring buffer write which can
hurt performance. This patch simply forces the slow path function
rb_move_tail() to always be a function.
The ring_buffer_benchmark module with reader_disabled=1 shows that
this patch changes the time to record an event from 135 ns to
132 ns. (3 ns or 2.22% improvement)
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ring_buffer.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index bca9637..0b88df8 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1823,7 +1823,10 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer,
local_sub(length, &tail_page->write);
}
-static struct ring_buffer_event *
+/*
+ * This is the slow path, force gcc not to inline it.
+ */
+static noinline struct ring_buffer_event *
rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
unsigned long length, unsigned long tail,
struct buffer_page *tail_page, u64 *ts)
@@ -1943,7 +1946,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
tail = write - length;
/* See if we shot pass the end of this buffer page */
- if (write > BUF_PAGE_SIZE)
+ if (unlikely(write > BUF_PAGE_SIZE))
return rb_move_tail(cpu_buffer, length, tail,
tail_page, ts);
--
1.7.1
next prev parent reply other threads:[~2010-10-21 1:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 1:39 [PATCH v2 0/8] [GIT PULL] ring-buffer: various updates Steven Rostedt
2010-10-21 1:39 ` Steven Rostedt [this message]
2010-10-21 1:39 ` [PATCH v2 2/8] ring-buffer: Pass timestamp by value and not by reference Steven Rostedt
2010-10-21 1:39 ` [PATCH v2 3/8] ring-buffer: Pass delta " Steven Rostedt
2010-10-21 1:39 ` [PATCH v2 4/8] ring-buffer: Remove ring_buffer_event_time_delta() Steven Rostedt
2010-10-21 1:39 ` [PATCH v2 5/8] ring-buffer: Bind time extend and data events together Steven Rostedt
2010-10-21 1:39 ` [PATCH v2 6/8] ring-buffer: Remove condition to add timestamp in fast path Steven Rostedt
2010-10-21 1:39 ` [PATCH v2 7/8] ring-buffer: Micro-optimize with some strategic inlining Steven Rostedt
2010-10-21 1:39 ` [PATCH v2 8/8] ring-buffer: Remove unused macro RB_TIMESTAMPS_PER_PAGE Steven Rostedt
2010-10-21 13:35 ` [PATCH v2 0/8] [GIT PULL] ring-buffer: various updates Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101021014142.692298333@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox