From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active
Date: Fri, 03 Apr 2009 20:27:10 -0400 [thread overview]
Message-ID: <20090404002809.395636493@goodmis.org> (raw)
In-Reply-To: 20090404002703.627460459@goodmis.org
[-- Attachment #1: 0007-function-graph-use-int-instead-of-atomic-for-ftrace.patch --]
[-- Type: text/plain, Size: 2209 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Impact: cleanup
The variable ftrace_graph_active is only modified under the
ftrace_lock mutex, thus an atomic is not necessary for modification.
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/ftrace.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index dfc969f..83dc994 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2519,7 +2519,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-static atomic_t ftrace_graph_active;
+static int ftrace_graph_active;
static struct notifier_block ftrace_suspend_notifier;
int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
@@ -2671,7 +2671,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
mutex_lock(&ftrace_lock);
/* we currently allow only one tracer registered at a time */
- if (atomic_read(&ftrace_graph_active)) {
+ if (ftrace_graph_active) {
ret = -EBUSY;
goto out;
}
@@ -2679,10 +2679,10 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;
register_pm_notifier(&ftrace_suspend_notifier);
- atomic_inc(&ftrace_graph_active);
+ ftrace_graph_active++;
ret = start_graph_tracing();
if (ret) {
- atomic_dec(&ftrace_graph_active);
+ ftrace_graph_active--;
goto out;
}
@@ -2700,7 +2700,7 @@ void unregister_ftrace_graph(void)
{
mutex_lock(&ftrace_lock);
- atomic_dec(&ftrace_graph_active);
+ ftrace_graph_active--;
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
ftrace_graph_entry = ftrace_graph_entry_stub;
@@ -2713,7 +2713,7 @@ void unregister_ftrace_graph(void)
/* Allocate a return stack for newly created task */
void ftrace_graph_init_task(struct task_struct *t)
{
- if (atomic_read(&ftrace_graph_active)) {
+ if (ftrace_graph_active) {
t->ret_stack = kmalloc(FTRACE_RETFUNC_DEPTH
* sizeof(struct ftrace_ret_stack),
GFP_KERNEL);
--
1.6.2.1
--
next prev parent reply other threads:[~2009-04-04 0:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-04 0:27 [PATCH 00/10] [GIT PULL] updates for tip/tracing/ftrace Steven Rostedt
2009-04-04 0:27 ` [PATCH 01/10] tracing: remove CALLER_ADDR2 from wakeup tracer Steven Rostedt
2009-04-04 0:27 ` [PATCH 02/10] tracing: use macros to denote usec and nsec per second Steven Rostedt
2009-04-04 0:27 ` [PATCH 03/10] tracing: fix incorrect return type of ns2usecs() V2 Steven Rostedt
2009-04-04 0:27 ` [PATCH 04/10] tracing/ftrace: fix missing include string.h Steven Rostedt
2009-04-04 0:27 ` [PATCH 05/10] tracing/ftrace: factorize the tracing files creation Steven Rostedt
2009-04-04 0:27 ` [PATCH 06/10] function-graph: add proper initialization for init task Steven Rostedt
2009-04-04 0:27 ` Steven Rostedt [this message]
2009-04-04 0:27 ` [PATCH 08/10] ftrace: Add check of sched_stopped for probe_sched_wakeup Steven Rostedt
2009-04-04 0:27 ` [PATCH 09/10] ftrace: Clean up enable logic for sched_switch Steven Rostedt
2009-04-04 0:27 ` [PATCH 10/10] tracing, x86: remove duplicated #include Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2009-04-06 16:37 [PATCH 00/10] [GIT PULL] for tip/tracing/core Steven Rostedt
2009-04-06 16:37 ` [PATCH 07/10] function-graph: use int instead of atomic for ftrace_graph_active 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=20090404002809.395636493@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=srostedt@redhat.com \
/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