]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ftrace: Only update the function code on write to filter files
authorSteven Rostedt <srostedt@redhat.com>
Sat, 30 Apr 2011 02:35:33 +0000 (22:35 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 17 May 2012 15:20:23 +0000 (11:20 -0400)
commit 058e297d34a404caaa5ed277de15698d8dc43000 upstream.

If function tracing is enabled, a read of the filter files will
cause the call to stop_machine to update the function trace sites.
It should only call stop_machine on write.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/trace/ftrace.c

index e28af02ac6cb07a841d633a1cb4e7238ddbdeafc..7dd746cc86ff3ffe5ae8cc5a3e59456da7e08208 100644 (file)
@@ -2355,14 +2355,16 @@ ftrace_regex_release(struct inode *inode, struct file *file, int enable)
                ftrace_match_records(parser->buffer, parser->idx, enable);
        }
 
-       mutex_lock(&ftrace_lock);
-       if (ftrace_start_up && ftrace_enabled)
-               ftrace_run_update_code(FTRACE_ENABLE_CALLS);
-       mutex_unlock(&ftrace_lock);
-
        trace_parser_put(parser);
        kfree(iter);
 
+       if (file->f_mode & FMODE_WRITE) {
+               mutex_lock(&ftrace_lock);
+               if (ftrace_start_up && ftrace_enabled)
+                       ftrace_run_update_code(FTRACE_ENABLE_CALLS);
+               mutex_unlock(&ftrace_lock);
+       }
+
        mutex_unlock(&ftrace_regex_lock);
        return 0;
 }