public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Li Zefan <lizf@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	lizf@cn.fujitsu.com, peterz@infradead.org, fweisbec@gmail.com,
	rostedt@goodmis.org, tglx@linutronix.de, jbaron@redhat.com,
	mhiramat@redhat.com
Subject: [tip:tracing/urgent] tracing: Change event->profile_count to be int type
Date: Mon, 14 Dec 2009 09:48:01 GMT	[thread overview]
Message-ID: <tip-e00bf2ec60605eb95687b7a0c3b83c87c48541dc@git.kernel.org> (raw)
In-Reply-To: <4B1DC549.5010705@cn.fujitsu.com>

Commit-ID:  e00bf2ec60605eb95687b7a0c3b83c87c48541dc
Gitweb:     http://git.kernel.org/tip/e00bf2ec60605eb95687b7a0c3b83c87c48541dc
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Tue, 8 Dec 2009 11:17:29 +0800
Committer:  Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Sun, 13 Dec 2009 18:37:28 +0100

tracing: Change event->profile_count to be int type

Like total_profile_count, struct ftrace_event_call::profile_count
is protected by event_mutex, so it doesn't need to be atomic_t.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <4B1DC549.5010705@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 include/linux/ftrace_event.h       |    2 +-
 include/linux/syscalls.h           |    2 --
 include/trace/ftrace.h             |    1 -
 kernel/trace/trace_event_profile.c |    6 +++---
 kernel/trace/trace_kprobe.c        |    1 -
 5 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index db97c64..2233c98 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -131,7 +131,7 @@ struct ftrace_event_call {
 	void			*mod;
 	void			*data;
 
-	atomic_t		profile_count;
+	int			profile_count;
 	int			(*profile_enable)(struct ftrace_event_call *);
 	void			(*profile_disable)(struct ftrace_event_call *);
 };
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 94ac284..72d6986 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -102,12 +102,10 @@ struct perf_event_attr;
 #ifdef CONFIG_EVENT_PROFILE
 
 #define TRACE_SYS_ENTER_PROFILE_INIT(sname)				       \
-	.profile_count = ATOMIC_INIT(-1),				       \
 	.profile_enable = prof_sysenter_enable,				       \
 	.profile_disable = prof_sysenter_disable,
 
 #define TRACE_SYS_EXIT_PROFILE_INIT(sname)				       \
-	.profile_count = ATOMIC_INIT(-1),				       \
 	.profile_enable = prof_sysexit_enable,				       \
 	.profile_disable = prof_sysexit_disable,
 #else
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 0c21af8..7352315 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -629,7 +629,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 #ifdef CONFIG_EVENT_PROFILE
 
 #define _TRACE_PROFILE_INIT(call)					\
-	.profile_count = ATOMIC_INIT(-1),				\
 	.profile_enable = ftrace_profile_enable_##call,			\
 	.profile_disable = ftrace_profile_disable_##call,
 
diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
index d9c60f8..9e25573 100644
--- a/kernel/trace/trace_event_profile.c
+++ b/kernel/trace/trace_event_profile.c
@@ -25,7 +25,7 @@ static int ftrace_profile_enable_event(struct ftrace_event_call *event)
 	char *buf;
 	int ret = -ENOMEM;
 
-	if (atomic_inc_return(&event->profile_count))
+	if (event->profile_count++ > 0)
 		return 0;
 
 	if (!total_profile_count) {
@@ -56,7 +56,7 @@ fail_buf_nmi:
 		perf_trace_buf = NULL;
 	}
 fail_buf:
-	atomic_dec(&event->profile_count);
+	event->profile_count--;
 
 	return ret;
 }
@@ -83,7 +83,7 @@ static void ftrace_profile_disable_event(struct ftrace_event_call *event)
 {
 	char *buf, *nmi_buf;
 
-	if (!atomic_add_negative(-1, &event->profile_count))
+	if (--event->profile_count > 0)
 		return;
 
 	event->profile_disable(event);
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index e3c80e9..6ed2234 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1426,7 +1426,6 @@ static int register_probe_event(struct trace_probe *tp)
 	call->unregfunc = probe_event_disable;
 
 #ifdef CONFIG_EVENT_PROFILE
-	atomic_set(&call->profile_count, -1);
 	call->profile_enable = probe_profile_enable;
 	call->profile_disable = probe_profile_disable;
 #endif

  reply	other threads:[~2009-12-14  9:48 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08  3:13 [PATCH 00/13] tracing: various cleanups and small fixes (updated) Li Zefan
2009-12-08  3:14 ` [PATCH 01/13] tracing: Extract duplicate ftrace_raw_init_event_foo() Li Zefan
2009-12-08  7:30   ` Frederic Weisbecker
2009-12-08  7:49     ` Li Zefan
2009-12-08  8:08       ` Frederic Weisbecker
2009-12-08 13:23       ` Steven Rostedt
2009-12-14  9:45   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:14 ` [PATCH 02/13] tracing: Extract calls to trace_define_common_fields() Li Zefan
2009-12-08  5:36   ` Lai Jiangshan
2009-12-08  7:57     ` Frederic Weisbecker
2009-12-08  8:03       ` Li Zefan
2009-12-08  8:16         ` Frederic Weisbecker
2009-12-08  8:21           ` Li Zefan
2009-12-08  8:59             ` Frederic Weisbecker
2009-12-14  9:45   ` [tip:tracing/urgent] tracing: Pull up " tip-bot for Li Zefan
2009-12-08  3:14 ` [PATCH 03/13] tracing: Move a printk out of ftrace_raw_reg_event_foo() Li Zefan
2009-12-08  7:43   ` Frederic Weisbecker
2009-12-08  7:49     ` Li Zefan
2009-12-08  8:11       ` Frederic Weisbecker
2009-12-14  9:46   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:15 ` [PATCH 04/13] ftrace: Return EINVAL when writing invalid val to set_ftrace_filter Li Zefan
2009-12-14  9:46   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:15 ` [PATCH 05/13] ftrace: Call trace_parser_clear() properly Li Zefan
2009-12-08  9:48   ` Frederic Weisbecker
2009-12-08 10:03     ` Li Zefan
2009-12-08 11:43       ` Frederic Weisbecker
2009-12-08 13:28       ` Steven Rostedt
2009-12-09  5:52   ` Steven Rostedt
2009-12-14  9:46   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:15 ` [PATCH 06/13] function-graph: Allow writing the same val to set_graph_function Li Zefan
2009-12-14  9:46   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:15 ` [PATCH 07/13] tracing: Use seq file for trace_options Li Zefan
2009-12-14  9:47   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:16 ` [PATCH 08/13] tracing: Use seq file for trace_clock Li Zefan
2009-12-14  9:47   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:16 ` [PATCH 09/13] tracing: Remove useless trace option Li Zefan
2009-12-14  9:47   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:17 ` [PATCH 10/13] tracing: Simplify trace_option_write() Li Zefan
2009-12-14  9:47   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:17 ` [PATCH 11/13] tracing: Change event->profile_count to be int type Li Zefan
2009-12-14  9:48   ` tip-bot for Li Zefan [this message]
2009-12-08  3:17 ` [PATCH 12/13] tracing/power: Remove two exports Li Zefan
2009-12-14  9:48   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-12-08  3:18 ` [PATCH 13/13] ksym_tracer: Fix compile warnings Li Zefan
2009-12-14  9:48   ` [tip:tracing/urgent] ksym_tracer: Fix bad cast tip-bot for Li Zefan
2009-12-08 12:23 ` [PATCH 00/13] tracing: various cleanups and small fixes (updated) Frederic Weisbecker
2009-12-08 13:29   ` Steven Rostedt
2009-12-08 13:41     ` Frederic Weisbecker
2009-12-09  5:53 ` 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=tip-e00bf2ec60605eb95687b7a0c3b83c87c48541dc@git.kernel.org \
    --to=lizf@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --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