aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-25 08:45:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-25 08:55:01 -0400
commit10989fb2451763fae6f42d85fa6106c8fd010cf5 (patch)
tree34c1b66501633ac3c0c287f72611eccc90ee1bc2 /kernel/perf_counter.c
parent6ab423e0eaca827fbd201ca4ae7d4f8573a366b2 (diff)
perf_counter: Fix PERF_COUNTER_CONTEXT_SWITCHES for cpu counters
Ingo noticed that cpu counters had 0 context switches, even though there was plenty scheduling on the cpu. 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.419025548@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 7a7a144870ef..14b1fe984832 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -924,14 +924,13 @@ void perf_counter_task_sched_out(struct task_struct *task,
924 struct perf_counter_context *next_ctx; 924 struct perf_counter_context *next_ctx;
925 struct pt_regs *regs; 925 struct pt_regs *regs;
926 926
927 regs = task_pt_regs(task);
928 perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0);
929
927 if (likely(!ctx || !cpuctx->task_ctx)) 930 if (likely(!ctx || !cpuctx->task_ctx))
928 return; 931 return;
929 932
930 update_context_time(ctx); 933 update_context_time(ctx);
931
932 regs = task_pt_regs(task);
933 perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0);
934
935 next_ctx = next->perf_counter_ctxp; 934 next_ctx = next->perf_counter_ctxp;
936 if (next_ctx && context_equiv(ctx, next_ctx)) { 935 if (next_ctx && context_equiv(ctx, next_ctx)) {
937 task->perf_counter_ctxp = next_ctx; 936 task->perf_counter_ctxp = next_ctx;