aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7dcf6e9f2b04..fdf913dfc7e8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1737,9 +1737,12 @@ static void clear_ftrace_pid(struct pid *pid)
1737{ 1737{
1738 struct task_struct *p; 1738 struct task_struct *p;
1739 1739
1740 rcu_read_lock();
1740 do_each_pid_task(pid, PIDTYPE_PID, p) { 1741 do_each_pid_task(pid, PIDTYPE_PID, p) {
1741 clear_tsk_trace_trace(p); 1742 clear_tsk_trace_trace(p);
1742 } while_each_pid_task(pid, PIDTYPE_PID, p); 1743 } while_each_pid_task(pid, PIDTYPE_PID, p);
1744 rcu_read_unlock();
1745
1743 put_pid(pid); 1746 put_pid(pid);
1744} 1747}
1745 1748
@@ -1747,9 +1750,11 @@ static void set_ftrace_pid(struct pid *pid)
1747{ 1750{
1748 struct task_struct *p; 1751 struct task_struct *p;
1749 1752
1753 rcu_read_lock();
1750 do_each_pid_task(pid, PIDTYPE_PID, p) { 1754 do_each_pid_task(pid, PIDTYPE_PID, p) {
1751 set_tsk_trace_trace(p); 1755 set_tsk_trace_trace(p);
1752 } while_each_pid_task(pid, PIDTYPE_PID, p); 1756 } while_each_pid_task(pid, PIDTYPE_PID, p);
1757 rcu_read_unlock();
1753} 1758}
1754 1759
1755static void clear_ftrace_pid_task(struct pid **pid) 1760static void clear_ftrace_pid_task(struct pid **pid)
@@ -2028,7 +2033,7 @@ free:
2028static int start_graph_tracing(void) 2033static int start_graph_tracing(void)
2029{ 2034{
2030 struct ftrace_ret_stack **ret_stack_list; 2035 struct ftrace_ret_stack **ret_stack_list;
2031 int ret; 2036 int ret, cpu;
2032 2037
2033 ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE * 2038 ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE *
2034 sizeof(struct ftrace_ret_stack *), 2039 sizeof(struct ftrace_ret_stack *),
@@ -2037,6 +2042,10 @@ static int start_graph_tracing(void)
2037 if (!ret_stack_list) 2042 if (!ret_stack_list)
2038 return -ENOMEM; 2043 return -ENOMEM;
2039 2044
2045 /* The cpu_boot init_task->ret_stack will never be freed */
2046 for_each_online_cpu(cpu)
2047 ftrace_graph_init_task(idle_task(cpu));
2048
2040 do { 2049 do {
2041 ret = alloc_retstack_tasklist(ret_stack_list); 2050 ret = alloc_retstack_tasklist(ret_stack_list);
2042 } while (ret == -EAGAIN); 2051 } while (ret == -EAGAIN);