Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Mon, 17 Aug 2009 23:39:34 +0200 | From | Ingo Molnar <> | Subject | [GIT PULL] perfcounters fixes |
| |
Linus,
Please pull the latest perfcounters-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perfcounters-fixes-for-linus
Thanks,
Ingo
------------------> Arnaldo Carvalho de Melo (1): perf record: Fix typo in pid_synthesize_comm_event
Carlos R. Mafra (1): perf: Rename perf-examples.txt to examples.txt
Paul Mackerras (1): perf_counter: Check task on counter read IPI
kernel/perf_counter.c | 11 +++++++++++ .../{perf-examples.txt => examples.txt} | 0 tools/perf/builtin-record.c | 2 +- 3 files changed, 12 insertions(+), 1 deletions(-) rename tools/perf/Documentation/{perf-examples.txt => examples.txt} (100%)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 534e20d..b8fe739 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c @@ -1503,10 +1503,21 @@ static void perf_counter_enable_on_exec(struct task_struct *task) */ static void __perf_counter_read(void *info) { + struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context); struct perf_counter *counter = info; struct perf_counter_context *ctx = counter->ctx; unsigned long flags; + /* + * If this is a task context, we need to check whether it is + * the current task context of this cpu. If not it has been + * scheduled out before the smp call arrived. In that case + * counter->count would have been updated to a recent sample + * when the counter was scheduled out. + */ + if (ctx->task && cpuctx->task_ctx != ctx) + return; + local_irq_save(flags); if (ctx->is_active) update_context_time(ctx); diff --git a/tools/perf/Documentation/perf-examples.txt b/tools/perf/Documentation/examples.txt similarity index 100% rename from tools/perf/Documentation/perf-examples.txt rename to tools/perf/Documentation/examples.txt diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 3d051b9..89a5ddc 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -219,7 +219,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full) snprintf(filename, sizeof(filename), "/proc/%d/status", pid); fp = fopen(filename, "r"); - if (fd == NULL) { + if (fp == NULL) { /* * We raced with a task exiting - just return: */
| ![\](/images/icornerr.gif) |