perf: Remove/simplify lockdep annotation
authorPeter Zijlstra <peterz@infradead.org>
Tue, 26 Jan 2016 14:25:15 +0000 (15:25 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 29 Jan 2016 07:35:36 +0000 (08:35 +0100)
Now that the perf_event_ctx_lock_nested() call has moved from
put_event() into perf_event_release_kernel() the first reason is no
longer valid as that can no longer happen.

The second reason seems to have been invalidated when Al Viro made fput()
unconditionally async in the following commit:

  4a9d4b024a31 ("switch fput to task_work_add")

such that munmap()->fput()->release()->perf_release() would no longer happen.

Therefore, remove the annotation. This should increase the efficiency
of lockdep coverage of perf locking.

Suggested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c

index 98c862aff8fae49b935715f432dc30c607679617..f1e53e8d4ae23469d5c59f12dc5b6999ab040b08 100644 (file)
@@ -3758,19 +3758,7 @@ int perf_event_release_kernel(struct perf_event *event)
        if (!is_kernel_event(event))
                perf_remove_from_owner(event);
 
-       /*
-        * 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_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.
-        */
-       ctx = perf_event_ctx_lock_nested(event, SINGLE_DEPTH_NESTING);
+       ctx = perf_event_ctx_lock(event);
        WARN_ON_ONCE(ctx->parent_ctx);
        perf_remove_from_context(event, DETACH_GROUP | DETACH_STATE);
        perf_event_ctx_unlock(event, ctx);
@@ -8759,14 +8747,6 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn)
         * perf_event_create_kernel_count() which does find_get_context()
         * without ctx::mutex (it cannot because of the move_group double mutex
         * lock thing). See the comments in perf_install_in_context().
-        *
-        * We can recurse on the same lock type through:
-        *
-        *   perf_event_exit_event()
-        *     put_event()
-        *       mutex_lock(&ctx->mutex)
-        *
-        * But since its the parent context it won't be the same instance.
         */
        mutex_lock(&child_ctx->mutex);
 
This page took 0.028869 seconds and 5 git commands to generate.