public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	<stable@vger.kernel.org>
Subject: [for-next][PATCH 2/7] ring-buffer: Put back the length if crossed page with add_timestamp
Date: Wed, 25 Nov 2015 11:08:40 -0500	[thread overview]
Message-ID: <20151125160912.271661017@goodmis.org> (raw)
In-Reply-To: 20151125160838.739491216@goodmis.org

[-- Attachment #1: 0002-ring-buffer-Put-back-the-length-if-crossed-page-with.patch --]
[-- Type: text/plain, Size: 1399 bytes --]

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

Commit fcc742eaad7c "ring-buffer: Add event descriptor to simplify passing
data" added a descriptor that holds various data instead of passing around
several variables through parameters. The problem was that one of the
parameters was modified in a function and the code was designed not to have
an effect on that modified  parameter. Now that the parameter is a
descriptor and any modifications to it are non-volatile, the size of the
data could be unnecessarily expanded.

Remove the extra space added if a timestamp was added and the event went
across the page.

Cc: stable@vger.kernel.org # 4.3+
Fixes: fcc742eaad7c "ring-buffer: Add event descriptor to simplify passing data"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ring_buffer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 4dd6d5bc4e11..9c6045a27ba3 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2797,8 +2797,11 @@ rb_reserve_next_event(struct ring_buffer *buffer,
 
 	event = __rb_reserve_next(cpu_buffer, &info);
 
-	if (unlikely(PTR_ERR(event) == -EAGAIN))
+	if (unlikely(PTR_ERR(event) == -EAGAIN)) {
+		if (info.add_timestamp)
+			info.length -= RB_LEN_TIME_EXTEND;
 		goto again;
+	}
 
 	if (!event)
 		goto out_fail;
-- 
2.6.1



  parent reply	other threads:[~2015-11-25 16:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 16:08 [for-next][PATCH 0/7] tracing: Updates for 4.5 (and some stuff going into 4.4) Steven Rostedt
2015-11-25 16:08 ` [for-next][PATCH 1/7] ring-buffer: Update read stamp with first real commit on page Steven Rostedt
2015-11-25 16:08 ` Steven Rostedt [this message]
2015-11-25 16:08 ` [for-next][PATCH 3/7] ftracetest: Add instance create and delete test Steven Rostedt
2015-11-25 16:31   ` Steven Rostedt
2015-12-09  5:09   ` Michael Ellerman
2015-12-11 19:36     ` Steven Rostedt
2016-01-15  5:08       ` Michael Ellerman
2016-01-15 17:50         ` Steven Rostedt
2016-01-18  5:47           ` Michael Ellerman
2016-02-18 12:37           ` Michael Ellerman
2016-02-18 14:04             ` Steven Rostedt
2015-11-25 16:08 ` [for-next][PATCH 4/7] ring-buffer: Use READ_ONCE() for most tail_page access Steven Rostedt
2015-11-25 16:08 ` [for-next][PATCH 5/7] ring-buffer: Remove redundant update of page timestamp Steven Rostedt
2015-11-25 16:08 ` [for-next][PATCH 6/7] ring-buffer: Process commits whenever moving to a new page Steven Rostedt
2015-11-25 20:22   ` Steven Rostedt
2015-11-25 16:08 ` [for-next][PATCH 7/7] tracing: Update cond flag when enabling or disabling a trigger 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=20151125160912.271661017@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    /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