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@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 4/5] tracing: make sched_switch stop/start light weight
Date: Tue, 17 Mar 2009 23:14:27 -0400	[thread overview]
Message-ID: <20090318033249.684068109@goodmis.org> (raw)
In-Reply-To: 20090318031423.981603258@goodmis.org

[-- Attachment #1: 0004-tracing-make-sched_switch-stop-start-light-weight.patch --]
[-- Type: text/plain, Size: 1764 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

The stopping and starting of a tracer should be light weight and
be able to be called in all contexts. The sched_switch grabbed
mutexes in the start/stop functions. This patch changes it to a
simple variable, on/off.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/trace/trace_sched_switch.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 77132c2..de35f20 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -18,6 +18,7 @@ static struct trace_array	*ctx_trace;
 static int __read_mostly	tracer_enabled;
 static int			sched_ref;
 static DEFINE_MUTEX(sched_register_mutex);
+static int			sched_stopped;
 
 static void
 probe_sched_switch(struct rq *__rq, struct task_struct *prev,
@@ -28,7 +29,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
 	int cpu;
 	int pc;
 
-	if (!sched_ref)
+	if (!sched_ref || sched_stopped)
 		return;
 
 	tracing_record_cmdline(prev);
@@ -193,6 +194,7 @@ static void stop_sched_trace(struct trace_array *tr)
 static int sched_switch_trace_init(struct trace_array *tr)
 {
 	ctx_trace = tr;
+	tracing_reset_online_cpus(tr);
 	tracing_start_sched_switch_record();
 	return 0;
 }
@@ -205,13 +207,12 @@ static void sched_switch_trace_reset(struct trace_array *tr)
 
 static void sched_switch_trace_start(struct trace_array *tr)
 {
-	tracing_reset_online_cpus(tr);
-	tracing_start_sched_switch();
+	sched_stopped = 0;
 }
 
 static void sched_switch_trace_stop(struct trace_array *tr)
 {
-	tracing_stop_sched_switch();
+	sched_stopped = 1;
 }
 
 static struct tracer sched_switch_trace __read_mostly =
-- 
1.6.2

-- 

  parent reply	other threads:[~2009-03-18  3:34 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18  3:14 [PATCH 0/5] [GIT PULL] updates for tip/tracing/ftrace Steven Rostedt
2009-03-18  3:14 ` [PATCH 1/5] ring-buffer: add api to allow a tracer to change clock source Steven Rostedt
2009-03-18  3:14 ` [PATCH 2/5] tracing: add global-clock option to provide cross CPU clock to traces Steven Rostedt
2009-03-18  3:14 ` [PATCH 3/5] tracing: optimization of branch tracer Steven Rostedt
2009-03-18  3:14 ` Steven Rostedt [this message]
2009-03-18  3:14 ` [PATCH 5/5] tracing: make power tracer start/stop methods lighter weight Steven Rostedt
2009-03-18  5:59 ` [PATCH 0/5] [GIT PULL] updates for tip/tracing/ftrace Ingo Molnar
2009-03-18  7:39   ` Ingo Molnar
2009-03-19  7:33     ` Ingo Molnar
2009-03-19 17:21       ` Steven Rostedt
2009-03-20 17:43         ` Paul E. McKenney
2009-03-20 18:36           ` Ingo Molnar
2009-03-20 18:38             ` Ingo Molnar
2009-03-20 19:19               ` Paul E. McKenney
2009-03-20 19:27                 ` Ingo Molnar
2009-03-20 19:41                   ` Paul E. McKenney
2009-03-20 19:46                   ` Frederic Weisbecker
2009-03-20 19:54                     ` Ingo Molnar
2009-03-20 20:48                       ` Frederic Weisbecker
2009-03-20 21:05                         ` Steven Rostedt
2009-03-21 10:01                           ` Ingo Molnar
2009-03-21 16:58                             ` Ingo Molnar
2009-03-21 17:25                               ` Steven Rostedt
2009-03-21 19:07                                 ` Paul E. McKenney
2009-03-21 20:09                                   ` Ingo Molnar
2009-03-21 21:01                                     ` Paul E. McKenney
2009-03-22 14:24                                       ` Ingo Molnar
2009-03-22 15:06                                         ` Ingo Molnar
2009-03-22 17:02                                           ` Ingo Molnar
2009-03-22 18:33                                             ` Steven Rostedt
2009-03-22 19:52                                               ` Ingo Molnar
2009-03-23 18:44                                           ` Steven Rostedt
2009-03-21 17:32                               ` Frederic Weisbecker
2009-03-21 17:44                                 ` Steven Rostedt
2009-03-21 17:53                                   ` Frederic Weisbecker
2009-03-21 18:17                                     ` Steven Rostedt
2009-03-21 20:03                                       ` Frederic Weisbecker
2009-03-21 18:18                                 ` Ingo Molnar
2009-03-21 20:09                                   ` Frederic Weisbecker
2009-03-21 20:46                                     ` Frederic Weisbecker
2009-03-22 19:41                               ` Ingo Molnar
2009-03-22 20:41                                 ` Ingo Molnar
2009-03-20 21:39                         ` Paul E. McKenney
2009-03-20 17:05       ` Frederic Weisbecker
2009-03-20 17:57         ` Frederic Weisbecker
2009-03-20 18:22           ` Steven Rostedt
2009-03-20 18:39             ` Frederic Weisbecker
2009-03-20 18:42             ` Ingo Molnar

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=20090318033249.684068109@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --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