From 02420a2825b795c333891ff1b54c350777bed84c Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 10 Jun 2009 22:53:37 +0200 Subject: [PATCH] --- yaml --- r: 147715 b: refs/heads/master c: 66fff22483d8542dfb4d61a28d21277bbde321e8 h: refs/heads/master i: 147713: 546043d010c46bd4db34341064240622973c1c5b 147711: fb128f46dc04be4f1555bf0614ce5f1f07d3a7c1 v: v3 --- [refs] | 2 +- trunk/kernel/perf_counter.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 84078e911c2a..641fdaaff14e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f7b7c26e01e51fe46097e11f179dc71ce7950084 +refs/heads/master: 66fff22483d8542dfb4d61a28d21277bbde321e8 diff --git a/trunk/kernel/perf_counter.c b/trunk/kernel/perf_counter.c index 51c571ee4d0b..ae591a1275a6 100644 --- a/trunk/kernel/perf_counter.c +++ b/trunk/kernel/perf_counter.c @@ -3879,7 +3879,18 @@ void perf_counter_exit_task(struct task_struct *child) spin_unlock(&child_ctx->lock); local_irq_restore(flags); - mutex_lock(&child_ctx->mutex); + /* + * We can recurse on the same lock type through: + * + * __perf_counter_exit_task() + * sync_child_counter() + * fput(parent_counter->filp) + * perf_release() + * mutex_lock(&ctx->mutex) + * + * But since its the parent context it won't be the same instance. + */ + mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING); again: list_for_each_entry_safe(child_counter, tmp, &child_ctx->counter_list,