summaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-25 14:45:27 +0200
committerIngo Molnar <mingo@elte.hu>2009-05-25 14:55:01 +0200
commit6ab423e0eaca827fbd201ca4ae7d4f8573a366b2 (patch)
tree072d227934bf213adf5c0dd022369e14f273dc48 /kernel/fork.c
parent771d7cde144d87f2d1fbee4da3c6234d61f7e42a (diff)
downloadop-kernel-dev-6ab423e0eaca827fbd201ca4ae7d4f8573a366b2.zip
op-kernel-dev-6ab423e0eaca827fbd201ca4ae7d4f8573a366b2.tar.gz
perf_counter: Propagate inheritance failures down the fork() path
Fail fork() when we fail inheritance for some reason (-ENOMEM most likely). Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: John Kacur <jkacur@redhat.com> LKML-Reference: <20090525124600.324656474@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 675e01e..c07c333 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1095,7 +1095,10 @@ static struct task_struct *copy_process(unsigned long clone_flags,
/* Perform scheduler related setup. Assign this task to a CPU. */
sched_fork(p, clone_flags);
- perf_counter_init_task(p);
+
+ retval = perf_counter_init_task(p);
+ if (retval)
+ goto bad_fork_cleanup_policy;
if ((retval = audit_alloc(p)))
goto bad_fork_cleanup_policy;
@@ -1295,6 +1298,7 @@ bad_fork_cleanup_semundo:
bad_fork_cleanup_audit:
audit_free(p);
bad_fork_cleanup_policy:
+ perf_counter_exit_task(p);
#ifdef CONFIG_NUMA
mpol_put(p->mempolicy);
bad_fork_cleanup_cgroup:
OpenPOWER on IntegriCloud