Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257036
b: refs/heads/master
c: b58f6b0
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 7, 2011
1 parent 25d7764 commit 28f1fa7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 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: 3ce2a0bc9dfb6423491afe0afc9f099e24b8cba4
refs/heads/master: b58f6b0dd3d677338b9065388cc2cc942b86338e
28 changes: 17 additions & 11 deletions trunk/kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,25 +1505,31 @@ static int __perf_install_in_context(void *info)
struct perf_event_context *task_ctx = cpuctx->task_ctx;
struct task_struct *task = current;

perf_ctx_lock(cpuctx, cpuctx->task_ctx);
perf_ctx_lock(cpuctx, task_ctx);
perf_pmu_disable(cpuctx->ctx.pmu);

/*
* If there was an active task_ctx schedule it out.
*/
if (task_ctx) {
if (task_ctx)
task_ctx_sched_out(task_ctx);
/*
* If the context we're installing events in is not the
* active task_ctx, flip them.
*/
if (ctx->task && task_ctx != ctx) {
raw_spin_unlock(&cpuctx->ctx.lock);
raw_spin_lock(&ctx->lock);
cpuctx->task_ctx = task_ctx = ctx;
}

/*
* If the context we're installing events in is not the
* active task_ctx, flip them.
*/
if (ctx->task && task_ctx != ctx) {
if (task_ctx)
raw_spin_unlock(&task_ctx->lock);
raw_spin_lock(&ctx->lock);
task_ctx = ctx;
}

if (task_ctx) {
cpuctx->task_ctx = task_ctx;
task = task_ctx->task;
}

cpu_ctx_sched_out(cpuctx, EVENT_ALL);

update_context_time(ctx);
Expand Down

0 comments on commit 28f1fa7

Please sign in to comment.