From: Steven Rostedt <rostedt@goodmis.org>
To: David Sharp <dhsharp@google.com>
Cc: linux-kernel@vger.kernel.org, vnagarnaik@google.com
Subject: Re: [PATCH] ring-buffer: fix uninitialized read_stamp
Date: Thu, 21 Jun 2012 11:56:44 -0400 [thread overview]
Message-ID: <1340294204.27036.183.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1340293617.27036.177.camel@gandalf.stny.rr.com>
On Thu, 2012-06-21 at 11:46 -0400, Steven Rostedt wrote:
> I'm wondering if it would be better to just not do the swap, and return
> NULL when it is empty. This would also fix the problem, as the
> read_stamp will only be set when you actually have data.
Does something like this work for you. Note, this is totally untested!
-- Steve
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index ad0239b..5943044 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3246,6 +3246,10 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer)
if (cpu_buffer->commit_page == cpu_buffer->reader_page)
goto out;
+ /* Don't bother swapping if the ring buffer is empty */
+ if (rb_num_of_entries(cpu_buffer) == 0)
+ goto out;
+
/*
* Reset the reader page to size zero.
*/
next prev parent reply other threads:[~2012-06-21 15:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 23:27 David Sharp
2012-06-07 23:34 ` David Sharp
2012-06-18 23:02 ` David Sharp
2012-06-21 14:52 ` Steven Rostedt
2012-06-21 15:46 ` Steven Rostedt
2012-06-21 15:56 ` Steven Rostedt [this message]
2012-06-22 20:50 ` David Sharp
2012-06-22 23:31 ` Steven Rostedt
2012-06-23 1:27 ` David Sharp
2012-06-27 0:35 ` David Sharp
2012-06-27 12:46 ` Steven Rostedt
2012-06-27 18:00 ` David Sharp
2012-06-27 18:05 ` Steven Rostedt
2012-07-06 10:49 ` [tip:perf/core] ring-buffer: Fix " tip-bot for Steven Rostedt
2012-07-06 11:30 ` [tip:perf/urgent] " tip-bot for 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=1340294204.27036.183.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=dhsharp@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vnagarnaik@google.com \
/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
all inboxes | Powered by JetHome®