diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 4e8ca23c0ede..6144b36cd897 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/mount.h> | 47 | #include <linux/mount.h> |
48 | #include <linux/audit.h> | 48 | #include <linux/audit.h> |
49 | #include <linux/memcontrol.h> | 49 | #include <linux/memcontrol.h> |
50 | #include <linux/ftrace.h> | ||
50 | #include <linux/profile.h> | 51 | #include <linux/profile.h> |
51 | #include <linux/rmap.h> | 52 | #include <linux/rmap.h> |
52 | #include <linux/acct.h> | 53 | #include <linux/acct.h> |
@@ -80,6 +81,8 @@ DEFINE_PER_CPU(unsigned long, process_counts) = 0; | |||
80 | 81 | ||
81 | __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ | 82 | __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ |
82 | 83 | ||
84 | DEFINE_TRACE(sched_process_fork); | ||
85 | |||
83 | int nr_processes(void) | 86 | int nr_processes(void) |
84 | { | 87 | { |
85 | int cpu; | 88 | int cpu; |
@@ -137,6 +140,7 @@ void free_task(struct task_struct *tsk) | |||
137 | prop_local_destroy_single(&tsk->dirties); | 140 | prop_local_destroy_single(&tsk->dirties); |
138 | free_thread_info(tsk->stack); | 141 | free_thread_info(tsk->stack); |
139 | rt_mutex_debug_task_free(tsk); | 142 | rt_mutex_debug_task_free(tsk); |
143 | ftrace_graph_exit_task(tsk); | ||
140 | free_task_struct(tsk); | 144 | free_task_struct(tsk); |
141 | } | 145 | } |
142 | EXPORT_SYMBOL(free_task); | 146 | EXPORT_SYMBOL(free_task); |
@@ -1080,6 +1084,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1080 | #ifdef CONFIG_DEBUG_MUTEXES | 1084 | #ifdef CONFIG_DEBUG_MUTEXES |
1081 | p->blocked_on = NULL; /* not blocked yet */ | 1085 | p->blocked_on = NULL; /* not blocked yet */ |
1082 | #endif | 1086 | #endif |
1087 | if (unlikely(ptrace_reparented(current))) | ||
1088 | ptrace_fork(p, clone_flags); | ||
1083 | 1089 | ||
1084 | /* Perform scheduler related setup. Assign this task to a CPU. */ | 1090 | /* Perform scheduler related setup. Assign this task to a CPU. */ |
1085 | sched_fork(p, clone_flags); | 1091 | sched_fork(p, clone_flags); |
@@ -1120,6 +1126,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1120 | } | 1126 | } |
1121 | } | 1127 | } |
1122 | 1128 | ||
1129 | ftrace_graph_init_task(p); | ||
1130 | |||
1123 | p->pid = pid_nr(pid); | 1131 | p->pid = pid_nr(pid); |
1124 | p->tgid = p->pid; | 1132 | p->tgid = p->pid; |
1125 | if (clone_flags & CLONE_THREAD) | 1133 | if (clone_flags & CLONE_THREAD) |
@@ -1128,7 +1136,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1128 | if (current->nsproxy != p->nsproxy) { | 1136 | if (current->nsproxy != p->nsproxy) { |
1129 | retval = ns_cgroup_clone(p, pid); | 1137 | retval = ns_cgroup_clone(p, pid); |
1130 | if (retval) | 1138 | if (retval) |
1131 | goto bad_fork_free_pid; | 1139 | goto bad_fork_free_graph; |
1132 | } | 1140 | } |
1133 | 1141 | ||
1134 | p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; | 1142 | p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; |
@@ -1221,7 +1229,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1221 | spin_unlock(¤t->sighand->siglock); | 1229 | spin_unlock(¤t->sighand->siglock); |
1222 | write_unlock_irq(&tasklist_lock); | 1230 | write_unlock_irq(&tasklist_lock); |
1223 | retval = -ERESTARTNOINTR; | 1231 | retval = -ERESTARTNOINTR; |
1224 | goto bad_fork_free_pid; | 1232 | goto bad_fork_free_graph; |
1225 | } | 1233 | } |
1226 | 1234 | ||
1227 | if (clone_flags & CLONE_THREAD) { | 1235 | if (clone_flags & CLONE_THREAD) { |
@@ -1258,6 +1266,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1258 | cgroup_post_fork(p); | 1266 | cgroup_post_fork(p); |
1259 | return p; | 1267 | return p; |
1260 | 1268 | ||
1269 | bad_fork_free_graph: | ||
1270 | ftrace_graph_exit_task(p); | ||
1261 | bad_fork_free_pid: | 1271 | bad_fork_free_pid: |
1262 | if (pid != &init_struct_pid) | 1272 | if (pid != &init_struct_pid) |
1263 | free_pid(pid); | 1273 | free_pid(pid); |