diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index b9e2edd00726..bb762b4dd217 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -61,7 +61,6 @@ | |||
61 | #include <linux/proc_fs.h> | 61 | #include <linux/proc_fs.h> |
62 | #include <linux/blkdev.h> | 62 | #include <linux/blkdev.h> |
63 | #include <linux/fs_struct.h> | 63 | #include <linux/fs_struct.h> |
64 | #include <trace/sched.h> | ||
65 | #include <linux/magic.h> | 64 | #include <linux/magic.h> |
66 | 65 | ||
67 | #include <asm/pgtable.h> | 66 | #include <asm/pgtable.h> |
@@ -71,6 +70,8 @@ | |||
71 | #include <asm/cacheflush.h> | 70 | #include <asm/cacheflush.h> |
72 | #include <asm/tlbflush.h> | 71 | #include <asm/tlbflush.h> |
73 | 72 | ||
73 | #include <trace/events/sched.h> | ||
74 | |||
74 | /* | 75 | /* |
75 | * Protected counters by write_lock_irq(&tasklist_lock) | 76 | * Protected counters by write_lock_irq(&tasklist_lock) |
76 | */ | 77 | */ |
@@ -83,8 +84,6 @@ DEFINE_PER_CPU(unsigned long, process_counts) = 0; | |||
83 | 84 | ||
84 | __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ | 85 | __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ |
85 | 86 | ||
86 | DEFINE_TRACE(sched_process_fork); | ||
87 | |||
88 | int nr_processes(void) | 87 | int nr_processes(void) |
89 | { | 88 | { |
90 | int cpu; | 89 | int cpu; |
@@ -982,6 +981,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
982 | if (!p) | 981 | if (!p) |
983 | goto fork_out; | 982 | goto fork_out; |
984 | 983 | ||
984 | ftrace_graph_init_task(p); | ||
985 | |||
985 | rt_mutex_init_task(p); | 986 | rt_mutex_init_task(p); |
986 | 987 | ||
987 | #ifdef CONFIG_PROVE_LOCKING | 988 | #ifdef CONFIG_PROVE_LOCKING |
@@ -1089,8 +1090,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1089 | #ifdef CONFIG_DEBUG_MUTEXES | 1090 | #ifdef CONFIG_DEBUG_MUTEXES |
1090 | p->blocked_on = NULL; /* not blocked yet */ | 1091 | p->blocked_on = NULL; /* not blocked yet */ |
1091 | #endif | 1092 | #endif |
1092 | if (unlikely(current->ptrace)) | 1093 | |
1093 | ptrace_fork(p, clone_flags); | 1094 | p->bts = NULL; |
1094 | 1095 | ||
1095 | /* Perform scheduler related setup. Assign this task to a CPU. */ | 1096 | /* Perform scheduler related setup. Assign this task to a CPU. */ |
1096 | sched_fork(p, clone_flags); | 1097 | sched_fork(p, clone_flags); |
@@ -1131,8 +1132,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1131 | } | 1132 | } |
1132 | } | 1133 | } |
1133 | 1134 | ||
1134 | ftrace_graph_init_task(p); | ||
1135 | |||
1136 | p->pid = pid_nr(pid); | 1135 | p->pid = pid_nr(pid); |
1137 | p->tgid = p->pid; | 1136 | p->tgid = p->pid; |
1138 | if (clone_flags & CLONE_THREAD) | 1137 | if (clone_flags & CLONE_THREAD) |
@@ -1141,7 +1140,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1141 | if (current->nsproxy != p->nsproxy) { | 1140 | if (current->nsproxy != p->nsproxy) { |
1142 | retval = ns_cgroup_clone(p, pid); | 1141 | retval = ns_cgroup_clone(p, pid); |
1143 | if (retval) | 1142 | if (retval) |
1144 | goto bad_fork_free_graph; | 1143 | goto bad_fork_free_pid; |
1145 | } | 1144 | } |
1146 | 1145 | ||
1147 | p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; | 1146 | p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; |
@@ -1233,7 +1232,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1233 | spin_unlock(¤t->sighand->siglock); | 1232 | spin_unlock(¤t->sighand->siglock); |
1234 | write_unlock_irq(&tasklist_lock); | 1233 | write_unlock_irq(&tasklist_lock); |
1235 | retval = -ERESTARTNOINTR; | 1234 | retval = -ERESTARTNOINTR; |
1236 | goto bad_fork_free_graph; | 1235 | goto bad_fork_free_pid; |
1237 | } | 1236 | } |
1238 | 1237 | ||
1239 | if (clone_flags & CLONE_THREAD) { | 1238 | if (clone_flags & CLONE_THREAD) { |
@@ -1268,8 +1267,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1268 | cgroup_post_fork(p); | 1267 | cgroup_post_fork(p); |
1269 | return p; | 1268 | return p; |
1270 | 1269 | ||
1271 | bad_fork_free_graph: | ||
1272 | ftrace_graph_exit_task(p); | ||
1273 | bad_fork_free_pid: | 1270 | bad_fork_free_pid: |
1274 | if (pid != &init_struct_pid) | 1271 | if (pid != &init_struct_pid) |
1275 | free_pid(pid); | 1272 | free_pid(pid); |
@@ -1409,7 +1406,7 @@ long do_fork(unsigned long clone_flags, | |||
1409 | } | 1406 | } |
1410 | 1407 | ||
1411 | audit_finish_fork(p); | 1408 | audit_finish_fork(p); |
1412 | tracehook_report_clone(trace, regs, clone_flags, nr, p); | 1409 | tracehook_report_clone(regs, clone_flags, nr, p); |
1413 | 1410 | ||
1414 | /* | 1411 | /* |
1415 | * We set PF_STARTING at creation in case tracing wants to | 1412 | * We set PF_STARTING at creation in case tracing wants to |