From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 6/7] ring-buffer: Process commits whenever moving to a new page.
Date: Wed, 25 Nov 2015 11:08:44 -0500 [thread overview]
Message-ID: <20151125160912.830251803@goodmis.org> (raw)
In-Reply-To: 20151125160838.739491216@goodmis.org
[-- Attachment #1: 0006-ring-buffer-Process-commits-whenever-moving-to-a-new.patch --]
[-- Type: text/plain, Size: 2105 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
When crossing over to a new page, commit the current work. This will allow
readers to get data with less latency, and also simplifies the work to get
timestamps working for interrupted events.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/module.c | 18 ++++++++++++++++--
kernel/trace/ring_buffer.c | 7 +++++++
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 8f051a106676..c0ae7c18c2fa 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -284,11 +284,25 @@ static void module_assert_mutex(void)
static void module_assert_mutex_or_preempt(void)
{
#ifdef CONFIG_LOCKDEP
+ static int once;
+
if (unlikely(!debug_locks))
return;
- WARN_ON(!rcu_read_lock_sched_held() &&
- !lockdep_is_held(&module_mutex));
+ /*
+ * Would be nice to use WARN_ON_ONCE(), but the warning
+ * that causes a stack trace may call __module_address()
+ * which may call here, and we trigger the warning again,
+ * before the WARN_ON_ONCE() updates its flag.
+ * To prevent the recursion, we need to open code the
+ * once logic.
+ */
+ if (!once &&
+ unlikely(!rcu_read_lock_sched_held() &&
+ !lockdep_is_held(&module_mutex))) {
+ once++;
+ WARN_ON(1);
+ }
#endif
}
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 631541a53baf..95181e36891a 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2129,6 +2129,8 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer,
local_sub(length, &tail_page->write);
}
+static inline void rb_end_commit(struct ring_buffer_per_cpu *cpu_buffer);
+
/*
* This is the slow path, force gcc not to inline it.
*/
@@ -2220,6 +2222,11 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
rb_reset_tail(cpu_buffer, tail, info);
+ /* Commit what we have for now. */
+ rb_end_commit(cpu_buffer);
+ /* rb_end_commit() decs committing */
+ local_inc(&cpu_buffer->committing);
+
/* fail and let the caller try again */
return ERR_PTR(-EAGAIN);
--
2.6.1
next prev 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 ` [for-next][PATCH 2/7] ring-buffer: Put back the length if crossed page with add_timestamp Steven Rostedt
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 ` Steven Rostedt [this message]
2015-11-25 20:22 ` [for-next][PATCH 6/7] ring-buffer: Process commits whenever moving to a new page 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.830251803@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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