Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191290
b: refs/heads/master
c: a0507c8
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 7, 2010
1 parent 822750e commit d921198
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 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: cce913178118b0b36742eb7544c2b38a0c957ee7
refs/heads/master: a0507c84bf47dfd204299774f45fd16da33f0619
16 changes: 14 additions & 2 deletions trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,19 @@ int perf_event_release_kernel(struct perf_event *event)
event->state = PERF_EVENT_STATE_FREE;

WARN_ON_ONCE(ctx->parent_ctx);
mutex_lock(&ctx->mutex);
/*
* There are two ways this annotation is useful:
*
* 1) there is a lock recursion from perf_event_exit_task
* see the comment there.
*
* 2) there is a lock-inversion with mmap_sem through
* perf_event_read_group(), which takes faults while
* holding ctx->mutex, however this is called after
* the last filedesc died, so there is no possibility
* to trigger the AB-BA case.
*/
mutex_lock_nested(&ctx->mutex, SINGLE_DEPTH_NESTING);
perf_event_remove_from_context(event);
mutex_unlock(&ctx->mutex);

Expand Down Expand Up @@ -5305,7 +5317,7 @@ void perf_event_exit_task(struct task_struct *child)
*
* But since its the parent context it won't be the same instance.
*/
mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING);
mutex_lock(&child_ctx->mutex);

again:
list_for_each_entry_safe(child_event, tmp, &child_ctx->pinned_groups,
Expand Down

0 comments on commit d921198

Please sign in to comment.