aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-29 08:25:58 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-29 10:21:51 -0400
commitefb3d17240d80e27508d238809168120fe4b93a4 (patch)
tree09c079a4ee4bfa531735b70691b8ab4d06d34e9b /kernel/perf_counter.c
parent012b84dae17126d8b5d159173091eb3db5a2bc43 (diff)
perf_counter: Fix COMM and MMAP events for cpu wide counters
Commit a63eaf34ae6 ("perf_counter: Dynamically allocate tasks' perf_counter_context struct") broke COMM and MMAP notification for cpu wide counters by dropping out early if there was no task context, thereby also not iterating the cpu context. Signed-off-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/perf_counter.c')
-rw-r--r--kernel/perf_counter.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 616c52426b32..58d6d198faa2 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2443,9 +2443,9 @@ static void perf_counter_comm_event(struct perf_comm_event *comm_event)
2443 2443
2444 cpuctx = &get_cpu_var(perf_cpu_context); 2444 cpuctx = &get_cpu_var(perf_cpu_context);
2445 perf_counter_comm_ctx(&cpuctx->ctx, comm_event); 2445 perf_counter_comm_ctx(&cpuctx->ctx, comm_event);
2446 if (cpuctx->task_ctx)
2447 perf_counter_comm_ctx(cpuctx->task_ctx, comm_event);
2446 put_cpu_var(perf_cpu_context); 2448 put_cpu_var(perf_cpu_context);
2447
2448 perf_counter_comm_ctx(current->perf_counter_ctxp, comm_event);
2449} 2449}
2450 2450
2451void perf_counter_comm(struct task_struct *task) 2451void perf_counter_comm(struct task_struct *task)
@@ -2454,8 +2454,6 @@ void perf_counter_comm(struct task_struct *task)
2454 2454
2455 if (!atomic_read(&nr_comm_tracking)) 2455 if (!atomic_read(&nr_comm_tracking))
2456 return; 2456 return;
2457 if (!current->perf_counter_ctxp)
2458 return;
2459 2457
2460 comm_event = (struct perf_comm_event){ 2458 comm_event = (struct perf_comm_event){
2461 .task = task, 2459 .task = task,
@@ -2570,10 +2568,10 @@ got_name:
2570 2568
2571 cpuctx = &get_cpu_var(perf_cpu_context); 2569 cpuctx = &get_cpu_var(perf_cpu_context);
2572 perf_counter_mmap_ctx(&cpuctx->ctx, mmap_event); 2570 perf_counter_mmap_ctx(&cpuctx->ctx, mmap_event);
2571 if (cpuctx->task_ctx)
2572 perf_counter_mmap_ctx(cpuctx->task_ctx, mmap_event);
2573 put_cpu_var(perf_cpu_context); 2573 put_cpu_var(perf_cpu_context);
2574 2574
2575 perf_counter_mmap_ctx(current->perf_counter_ctxp, mmap_event);
2576
2577 kfree(buf); 2575 kfree(buf);
2578} 2576}
2579 2577
@@ -2584,8 +2582,6 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
2584 2582
2585 if (!atomic_read(&nr_mmap_tracking)) 2583 if (!atomic_read(&nr_mmap_tracking))
2586 return; 2584 return;
2587 if (!current->perf_counter_ctxp)
2588 return;
2589 2585
2590 mmap_event = (struct perf_mmap_event){ 2586 mmap_event = (struct perf_mmap_event){
2591 .file = file, 2587 .file = file,