From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Li Zefan <lizf@cn.fujitsu.com>, Christoph Hellwig <hch@lst.de>
Subject: [PATCH 1/7] ring-buffer: remove unneeded conditional in rb_reserve_next
Date: Wed, 06 May 2009 23:13:36 -0400 [thread overview]
Message-ID: <20090507031433.562803300@goodmis.org> (raw)
In-Reply-To: 20090507031335.815354104@goodmis.org
[-- Attachment #1: 0001-ring-buffer-remove-unneeded-conditional-in-rb_reser.patch --]
[-- Type: text/plain, Size: 1482 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The code in __rb_reserve_next checks on page overflow if it is the
original commiter and then resets the page back to the original
setting. Although this is fine, and the code is correct, it is
a bit fragil. Some experimental work I did breaks it easily.
The better and more robust solution is to have all commiters that
overflow the page, simply subtract what they added.
[ Impact: more robust ring buffer account management ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ring_buffer.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 424129e..03ed52b 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1290,9 +1290,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
rb_event_set_padding(event);
}
- if (tail <= BUF_PAGE_SIZE)
- /* Set the write back to the previous setting */
- local_set(&tail_page->write, tail);
+ /* Set the write back to the previous setting */
+ local_sub(length, &tail_page->write);
/*
* If this was a commit entry that failed,
@@ -1311,8 +1310,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
out_reset:
/* reset write */
- if (tail <= BUF_PAGE_SIZE)
- local_set(&tail_page->write, tail);
+ local_sub(length, &tail_page->write);
if (likely(lock_taken))
__raw_spin_unlock(&cpu_buffer->lock);
--
1.6.2.4
--
next prev parent reply other threads:[~2009-05-07 3:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-07 3:13 [PATCH 0/7] [GIT PULL] tracing/ring-buffer: more updates for tip Steven Rostedt
2009-05-07 3:13 ` Steven Rostedt [this message]
2009-05-07 8:23 ` [PATCH 1/7] ring-buffer: remove unneeded conditional in rb_reserve_next Ingo Molnar
2009-05-07 3:13 ` [PATCH 2/7] ring-buffer: check for failed allocation in ring buffer benchmark Steven Rostedt
2009-05-07 3:13 ` [PATCH 3/7] ring-buffer: make moving the tail page a separate function Steven Rostedt
2009-05-07 8:27 ` Ingo Molnar
2009-05-07 13:26 ` Steven Rostedt
2009-05-07 13:56 ` Ingo Molnar
2009-05-07 3:13 ` [PATCH 4/7] ring-buffer: change test to be more latency friendly Steven Rostedt
2009-05-07 8:31 ` Ingo Molnar
2009-05-07 8:34 ` Ingo Molnar
2009-05-07 13:51 ` Steven Rostedt
2009-05-07 3:13 ` [PATCH 5/7] tracing: update sample with TRACE_INCLUDE_FILE Steven Rostedt
2009-05-07 3:13 ` [PATCH 6/7] tracing: reset ring buffer when removing modules with events Steven Rostedt
2009-05-07 3:51 ` Li Zefan
2009-05-07 16:24 ` Frederic Weisbecker
2009-05-07 3:13 ` [PATCH 7/7] tracing: add hierarchical enabling of events Steven Rostedt
2009-05-07 3:51 ` Li Zefan
2009-05-07 13:21 ` Steven Rostedt
2009-05-08 1:11 ` Li Zefan
2009-05-08 1:23 ` Steven Rostedt
2009-05-08 1:24 ` Steven Rostedt
2009-05-07 16:28 ` Frederic Weisbecker
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=20090507031433.562803300@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
/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