diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-08-20 20:24:33 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-08-20 20:24:33 +0200 |
commit | 39cf0518d89d1f0af79554457c52adb5b12fa43c (patch) | |
tree | 3d04a6efe1e2afb6db7091af4b7033a56ae1b077 /kernel/perf_counter.c | |
parent | af15c1addf920d830b030e3489a482456904ca8c (diff) | |
parent | 6c30c53fd5ae6a99a23ad78e90c428d2c8ffb07f (diff) | |
download | linux-39cf0518d89d1f0af79554457c52adb5b12fa43c.tar.bz2 |
Merge branch 'master' into for-linus
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r-- | kernel/perf_counter.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 534e20d14d63..36f65e2b8b57 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); @@ -2008,6 +2019,10 @@ int perf_counter_task_disable(void) return 0; } +#ifndef PERF_COUNTER_INDEX_OFFSET +# define PERF_COUNTER_INDEX_OFFSET 0 +#endif + static int perf_counter_index(struct perf_counter *counter) { if (counter->state != PERF_COUNTER_STATE_ACTIVE) |