Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121253
b: refs/heads/master
c: 0ef8cde
h: refs/heads/master
i:
  121251: c31e594
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Dec 4, 2008
1 parent c045876 commit fa085a1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ea4e2bc4d9f7370e57a343ccb5e7c0ad3222ec3c
refs/heads/master: 0ef8cde56ab92ab3f65221246dc1622c6b5068b3
28 changes: 25 additions & 3 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
int ftrace_enabled __read_mostly;
static int last_ftrace_enabled;

/* ftrace_pid_trace >= 0 will only trace threads with this pid */
/* set when tracing only a pid */
static int ftrace_pid_trace = -1;

/* Quick disabling of function tracer. */
Expand Down Expand Up @@ -90,7 +90,7 @@ static void ftrace_list_func(unsigned long ip, unsigned long parent_ip)

static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip)
{
if (current->pid != ftrace_pid_trace)
if (!test_tsk_trace_trace(current))
return;

ftrace_pid_function(ip, parent_ip);
Expand Down Expand Up @@ -1714,11 +1714,33 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
ftrace_pid_trace = -1;

} else {
struct task_struct *p;
int found = 0;

if (ftrace_pid_trace == val)
goto out;

ftrace_pid_trace = val;
/*
* Find the task that matches this pid.
* TODO: use pid namespaces instead.
*/
rcu_read_lock();
for_each_process(p) {
if (p->pid == val) {
found = 1;
set_tsk_trace_trace(p);
} else if (test_tsk_trace_trace(p))
clear_tsk_trace_trace(p);
}
rcu_read_unlock();

if (found)
ftrace_pid_trace = val;
else {
if (ftrace_pid_trace < 0)
goto out;
ftrace_pid_trace = -1;
}
}

/* update the function call */
Expand Down

0 comments on commit fa085a1

Please sign in to comment.