Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147573
b: refs/heads/master
c: 3f4dee2
h: refs/heads/master
i:
  147571: 1e1a156
v: v3
  • Loading branch information
Ingo Molnar committed May 29, 2009
1 parent 829a867 commit c41045e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad3a37de81c45f6c20d410ece86004b98f7b6d84
refs/heads/master: 3f4dee227348daac32f36daad9a91059efd0723e
28 changes: 20 additions & 8 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,18 @@ static void __perf_counter_remove_from_context(void *info)
struct perf_counter_context *ctx = counter->ctx;
unsigned long flags;

local_irq_save(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.
*/
if (ctx->task && cpuctx->task_ctx != ctx)
if (ctx->task && cpuctx->task_ctx != ctx) {
local_irq_restore(flags);
return;
}

spin_lock_irqsave(&ctx->lock, flags);
spin_lock(&ctx->lock);
/*
* Protect the list operation against NMI by disabling the
* counters on a global level.
Expand Down Expand Up @@ -382,14 +385,17 @@ static void __perf_counter_disable(void *info)
struct perf_counter_context *ctx = counter->ctx;
unsigned long flags;

local_irq_save(flags);
/*
* If this is a per-task counter, need to check whether this
* counter's task is the current task on this cpu.
*/
if (ctx->task && cpuctx->task_ctx != ctx)
if (ctx->task && cpuctx->task_ctx != ctx) {
local_irq_restore(flags);
return;
}

spin_lock_irqsave(&ctx->lock, flags);
spin_lock(&ctx->lock);

/*
* If the counter is on, turn it off.
Expand Down Expand Up @@ -615,6 +621,7 @@ static void __perf_install_in_context(void *info)
unsigned long flags;
int err;

local_irq_save(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
Expand All @@ -623,12 +630,14 @@ static void __perf_install_in_context(void *info)
* on this cpu because it had no counters.
*/
if (ctx->task && cpuctx->task_ctx != ctx) {
if (cpuctx->task_ctx || ctx->task != current)
if (cpuctx->task_ctx || ctx->task != current) {
local_irq_restore(flags);
return;
}
cpuctx->task_ctx = ctx;
}

spin_lock_irqsave(&ctx->lock, flags);
spin_lock(&ctx->lock);
ctx->is_active = 1;
update_context_time(ctx);

Expand Down Expand Up @@ -745,17 +754,20 @@ static void __perf_counter_enable(void *info)
unsigned long flags;
int err;

local_irq_save(flags);
/*
* If this is a per-task counter, need to check whether this
* counter's task is the current task on this cpu.
*/
if (ctx->task && cpuctx->task_ctx != ctx) {
if (cpuctx->task_ctx || ctx->task != current)
if (cpuctx->task_ctx || ctx->task != current) {
local_irq_restore(flags);
return;
}
cpuctx->task_ctx = ctx;
}

spin_lock_irqsave(&ctx->lock, flags);
spin_lock(&ctx->lock);
ctx->is_active = 1;
update_context_time(ctx);

Expand Down

0 comments on commit c41045e

Please sign in to comment.