aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-11 11:55:42 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-11 11:55:42 -0400
commit940010c5a314a7bd9b498593bc6ba1718ac5aec5 (patch)
treed141e08ced08c40c6a8e3ab2cdecde5ff14e560f /kernel/fork.c
parent8dc8e5e8bc0ce00b0f656bf972f67cd8a72759e5 (diff)
parent991ec02cdca33b03a132a0cacfe6f0aa0be9aa8d (diff)
Merge branch 'linus' into perfcounters/core
Conflicts: arch/x86/kernel/irqinit.c arch/x86/kernel/irqinit_64.c arch/x86/kernel/traps.c arch/x86/mm/fault.c include/linux/sched.h kernel/exit.c
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index f4466ca37ece..4430eb1376f2 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#include <linux/perf_counter.h> 65#include <linux/perf_counter.h>
67 66
@@ -72,6 +71,8 @@
72#include <asm/cacheflush.h> 71#include <asm/cacheflush.h>
73#include <asm/tlbflush.h> 72#include <asm/tlbflush.h>
74 73
74#include <trace/events/sched.h>
75
75/* 76/*
76 * Protected counters by write_lock_irq(&tasklist_lock) 77 * Protected counters by write_lock_irq(&tasklist_lock)
77 */ 78 */
@@ -84,8 +85,6 @@ DEFINE_PER_CPU(unsigned long, process_counts) = 0;
84 85
85__cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ 86__cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */
86 87
87DEFINE_TRACE(sched_process_fork);
88
89int nr_processes(void) 88int nr_processes(void)
90{ 89{
91 int cpu; 90 int cpu;
@@ -983,6 +982,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
983 if (!p) 982 if (!p)
984 goto fork_out; 983 goto fork_out;
985 984
985 ftrace_graph_init_task(p);
986
986 rt_mutex_init_task(p); 987 rt_mutex_init_task(p);
987 988
988#ifdef CONFIG_PROVE_LOCKING 989#ifdef CONFIG_PROVE_LOCKING
@@ -1090,8 +1091,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1090#ifdef CONFIG_DEBUG_MUTEXES 1091#ifdef CONFIG_DEBUG_MUTEXES
1091 p->blocked_on = NULL; /* not blocked yet */ 1092 p->blocked_on = NULL; /* not blocked yet */
1092#endif 1093#endif
1093 if (unlikely(current->ptrace)) 1094
1094 ptrace_fork(p, clone_flags); 1095 p->bts = NULL;
1095 1096
1096 /* Perform scheduler related setup. Assign this task to a CPU. */ 1097 /* Perform scheduler related setup. Assign this task to a CPU. */
1097 sched_fork(p, clone_flags); 1098 sched_fork(p, clone_flags);
@@ -1136,8 +1137,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1136 } 1137 }
1137 } 1138 }
1138 1139
1139 ftrace_graph_init_task(p);
1140
1141 p->pid = pid_nr(pid); 1140 p->pid = pid_nr(pid);
1142 p->tgid = p->pid; 1141 p->tgid = p->pid;
1143 if (clone_flags & CLONE_THREAD) 1142 if (clone_flags & CLONE_THREAD)
@@ -1146,7 +1145,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1146 if (current->nsproxy != p->nsproxy) { 1145 if (current->nsproxy != p->nsproxy) {
1147 retval = ns_cgroup_clone(p, pid); 1146 retval = ns_cgroup_clone(p, pid);
1148 if (retval) 1147 if (retval)
1149 goto bad_fork_free_graph; 1148 goto bad_fork_free_pid;
1150 } 1149 }
1151 1150
1152 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; 1151 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
@@ -1238,7 +1237,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1238 spin_unlock(&current->sighand->siglock); 1237 spin_unlock(&current->sighand->siglock);
1239 write_unlock_irq(&tasklist_lock); 1238 write_unlock_irq(&tasklist_lock);
1240 retval = -ERESTARTNOINTR; 1239 retval = -ERESTARTNOINTR;
1241 goto bad_fork_free_graph; 1240 goto bad_fork_free_pid;
1242 } 1241 }
1243 1242
1244 if (clone_flags & CLONE_THREAD) { 1243 if (clone_flags & CLONE_THREAD) {
@@ -1273,8 +1272,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1273 cgroup_post_fork(p); 1272 cgroup_post_fork(p);
1274 return p; 1273 return p;
1275 1274
1276bad_fork_free_graph:
1277 ftrace_graph_exit_task(p);
1278bad_fork_free_pid: 1275bad_fork_free_pid:
1279 if (pid != &init_struct_pid) 1276 if (pid != &init_struct_pid)
1280 free_pid(pid); 1277 free_pid(pid);
@@ -1421,7 +1418,7 @@ long do_fork(unsigned long clone_flags,
1421 } 1418 }
1422 1419
1423 audit_finish_fork(p); 1420 audit_finish_fork(p);
1424 tracehook_report_clone(trace, regs, clone_flags, nr, p); 1421 tracehook_report_clone(regs, clone_flags, nr, p);
1425 1422
1426 /* 1423 /*
1427 * We set PF_STARTING at creation in case tracing wants to 1424 * We set PF_STARTING at creation in case tracing wants to