public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, paulus@samba.org,
	hpa@zytor.com, mingo@redhat.com, jkacur@redhat.com,
	a.p.zijlstra@chello.nl, tglx@linutronix.de,
	cjashfor@linux.vnet.ibm.com, mingo@elte.hu
Subject: [tip:perfcounters/core] perf_counter: Fix PERF_COUNTER_CONTEXT_SWITCHES for cpu counters
Date: Mon, 25 May 2009 13:04:18 GMT	[thread overview]
Message-ID: <tip-10989fb2451763fae6f42d85fa6106c8fd010cf5@git.kernel.org> (raw)
In-Reply-To: <20090525124600.419025548@chello.nl>

Commit-ID:  10989fb2451763fae6f42d85fa6106c8fd010cf5
Gitweb:     http://git.kernel.org/tip/10989fb2451763fae6f42d85fa6106c8fd010cf5
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 25 May 2009 14:45:28 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 25 May 2009 14:55:01 +0200

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>


---
 kernel/perf_counter.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 7a7a144..14b1fe9 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,
 	struct perf_counter_context *next_ctx;
 	struct pt_regs *regs;
 
+	regs = task_pt_regs(task);
+	perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0);
+
 	if (likely(!ctx || !cpuctx->task_ctx))
 		return;
 
 	update_context_time(ctx);
-
-	regs = task_pt_regs(task);
-	perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0);
-
 	next_ctx = next->perf_counter_ctxp;
 	if (next_ctx && context_equiv(ctx, next_ctx)) {
 		task->perf_counter_ctxp = next_ctx;

      reply	other threads:[~2009-05-25 13:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-25 12:45 [PATCH 0/5] yet more perf counter patches Peter Zijlstra
2009-05-25 12:45 ` [PATCH 1/5] perf_counter: fix perf-$cmd invokation Peter Zijlstra
2009-05-25 13:03   ` [tip:perfcounters/core] perf_counter: Fix " tip-bot for Peter Zijlstra
2009-05-25 12:45 ` [PATCH 2/5] perf_counter: remove unused ABI bits Peter Zijlstra
2009-05-25 13:03   ` [tip:perfcounters/core] perf_counter: Remove " tip-bot for Peter Zijlstra
2009-05-25 12:45 ` [PATCH 3/5] perf_counter: make pctrl() affect inherited counters too Peter Zijlstra
2009-05-25 13:03   ` [tip:perfcounters/core] perf_counter: Make " tip-bot for Peter Zijlstra
2009-05-25 12:45 ` [PATCH 4/5] perf_counter: propagate inheritance failures down the fork() path Peter Zijlstra
2009-05-25 13:04   ` [tip:perfcounters/core] perf_counter: Propagate " tip-bot for Peter Zijlstra
2009-05-25 12:45 ` [PATCH 5/5] perf_counter: fix PERF_COUNTER_CONTEXT_SWITCHES for cpu counters Peter Zijlstra
2009-05-25 13:04   ` tip-bot for Peter Zijlstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-10989fb2451763fae6f42d85fa6106c8fd010cf5@git.kernel.org \
    --to=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox