aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/perf_counter.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 679c3b5bb7d4..d162d2f0b270 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -597,6 +597,8 @@ static void add_counter_to_ctx(struct perf_counter *counter,
597 597
598/* 598/*
599 * Cross CPU call to install and enable a performance counter 599 * Cross CPU call to install and enable a performance counter
600 *
601 * Must be called with ctx->mutex held
600 */ 602 */
601static void __perf_install_in_context(void *info) 603static void __perf_install_in_context(void *info)
602{ 604{
@@ -1496,13 +1498,13 @@ static void perf_counter_for_each_sibling(struct perf_counter *counter,
1496 struct perf_counter_context *ctx = counter->ctx; 1498 struct perf_counter_context *ctx = counter->ctx;
1497 struct perf_counter *sibling; 1499 struct perf_counter *sibling;
1498 1500
1499 spin_lock_irq(&ctx->lock); 1501 mutex_lock(&ctx->mutex);
1500 counter = counter->group_leader; 1502 counter = counter->group_leader;
1501 1503
1502 func(counter); 1504 func(counter);
1503 list_for_each_entry(sibling, &counter->sibling_list, list_entry) 1505 list_for_each_entry(sibling, &counter->sibling_list, list_entry)
1504 func(sibling); 1506 func(sibling);
1505 spin_unlock_irq(&ctx->lock); 1507 mutex_unlock(&ctx->mutex);
1506} 1508}
1507 1509
1508static void perf_counter_for_each_child(struct perf_counter *counter, 1510static void perf_counter_for_each_child(struct perf_counter *counter,
@@ -3414,7 +3416,10 @@ __perf_counter_exit_task(struct task_struct *child,
3414 struct perf_counter *parent_counter; 3416 struct perf_counter *parent_counter;
3415 3417
3416 update_counter_times(child_counter); 3418 update_counter_times(child_counter);
3419
3420 spin_lock_irq(&child_ctx->lock);
3417 list_del_counter(child_counter, child_ctx); 3421 list_del_counter(child_counter, child_ctx);
3422 spin_unlock_irq(&child_ctx->lock);
3418 3423
3419 parent_counter = child_counter->parent; 3424 parent_counter = child_counter->parent;
3420 /* 3425 /*