The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Zhaolei <zhaolei@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	rostedt@goodmis.org, zhaolei@cn.fujitsu.com, tglx@linutronix.de
Subject: [tip:tracing/core] ftrace: clean up enable logic for sched_switch
Date: Wed, 8 Apr 2009 06:55:15 GMT	[thread overview]
Message-ID: <tip-dcef788eb9659b61a2110284fcce3ca6e63480d2@git.kernel.org> (raw)
In-Reply-To: <49D1C596.5050203@cn.fujitsu.com>

Commit-ID:  dcef788eb9659b61a2110284fcce3ca6e63480d2
Gitweb:     http://git.kernel.org/tip/dcef788eb9659b61a2110284fcce3ca6e63480d2
Author:     Zhaolei <zhaolei@cn.fujitsu.com>
AuthorDate: Tue, 31 Mar 2009 15:26:14 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 7 Apr 2009 14:43:09 +0200

ftrace: clean up enable logic for sched_switch

Unify sched_switch and sched_wakeup's action to following logic:
Do record_cmdline when start_cmdline_record() is called.
Start tracing events when the tracer is started.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
LKML-Reference: <49D1C596.5050203@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


---
 kernel/trace/trace_sched_switch.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 9117cea..9d8cccd 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -29,13 +29,13 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
 	int cpu;
 	int pc;
 
-	if (!sched_ref || sched_stopped)
+	if (unlikely(!sched_ref))
 		return;
 
 	tracing_record_cmdline(prev);
 	tracing_record_cmdline(next);
 
-	if (!tracer_enabled)
+	if (!tracer_enabled || sched_stopped)
 		return;
 
 	pc = preempt_count();
@@ -56,15 +56,15 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)
 	unsigned long flags;
 	int cpu, pc;
 
-	if (!likely(tracer_enabled))
+	if (unlikely(!sched_ref))
 		return;
 
-	pc = preempt_count();
 	tracing_record_cmdline(current);
 
-	if (sched_stopped)
+	if (!tracer_enabled || sched_stopped)
 		return;
 
+	pc = preempt_count();
 	local_irq_save(flags);
 	cpu = raw_smp_processor_id();
 	data = ctx_trace->data[cpu];

      parent reply	other threads:[~2009-04-08  6:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31  7:24 [PATCH v2 0/2] ftrace: Add check of sched_stopped for probe_sched_wakeup Zhaolei
2009-03-31  7:24 ` [PATCH v2 1/2] " Zhaolei
2009-04-03 19:50   ` Steven Rostedt
2009-04-07 13:13   ` [tip:tracing/urgent] " Zhaolei
2009-03-31  7:26 ` [PATCH v2 2/2] ftrace: Clean up enable logic for sched_switch Zhaolei
2009-04-03 20:14   ` Steven Rostedt
2009-04-08  6:55   ` Zhaolei [this message]

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=tip-dcef788eb9659b61a2110284fcce3ca6e63480d2@git.kernel.org \
    --to=zhaolei@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --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