From: Zhaolei <zhaolei@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] ftrace: Clean up enable logic for sched_switch
Date: Tue, 31 Mar 2009 15:26:14 +0800 [thread overview]
Message-ID: <49D1C596.5050203@cn.fujitsu.com> (raw)
In-Reply-To: <49D1C51C.7000407@cn.fujitsu.com>
Unify sched_switch and sched_wakeup's action to following logic:
Do record_cmdline when start_cmdline_record() called.
Trace event when trace is inited and started.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
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];
--
1.5.5.3
next prev parent reply other threads:[~2009-03-31 7:29 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 ` Zhaolei [this message]
2009-04-03 20:14 ` [PATCH v2 2/2] ftrace: Clean up enable logic for sched_switch Steven Rostedt
2009-04-08 6:55 ` [tip:tracing/core] ftrace: clean " Zhaolei
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=49D1C596.5050203@cn.fujitsu.com \
--to=zhaolei@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.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