diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-05-17 05:08:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-29 08:28:37 -0400 |
commit | 012b84dae17126d8b5d159173091eb3db5a2bc43 (patch) | |
tree | 0b5f85b66084c3186a8e4c56d9ed074d3b2593ee /kernel | |
parent | 3f4dee227348daac32f36daad9a91059efd0723e (diff) |
perf_counter: Robustify counter-free logic
This fixes a nasty crash and highlights a bug that we were
freeing failed-fork() counters incorrectly.
(the fix for that will come separately)
[ Impact: fix crashes/lockups with inherited counters ]
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_counter.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index eb346048f00f..616c52426b32 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -1004,6 +1004,10 @@ static void __perf_counter_task_sched_out(struct perf_counter_context *ctx) | |||
1004 | 1004 | ||
1005 | if (!cpuctx->task_ctx) | 1005 | if (!cpuctx->task_ctx) |
1006 | return; | 1006 | return; |
1007 | |||
1008 | if (WARN_ON_ONCE(ctx != cpuctx->task_ctx)) | ||
1009 | return; | ||
1010 | |||
1007 | __perf_counter_sched_out(ctx, cpuctx); | 1011 | __perf_counter_sched_out(ctx, cpuctx); |
1008 | cpuctx->task_ctx = NULL; | 1012 | cpuctx->task_ctx = NULL; |
1009 | } | 1013 | } |