• Peter Zijlstra's avatar
    perf/core: Better explain the inherit magic · d8a8cfc7
    Peter Zijlstra authored
    While going through the event inheritance code Oleg got confused.
    
    Add some comments to better explain the silent dissapearance of
    orphaned events.
    
    So what happens is that at perf_event_release_kernel() time; when an
    event looses its connection to userspace (and ceases to exist from the
    user's perspective) we can still have an arbitrary amount of inherited
    copies of the event. We want to synchronously find and remove all
    these child events.
    
    Since that requires a bit of lock juggling, there is the possibility
    that concurrent clone()s will create new child events. Therefore we
    first mark the parent event as DEAD, which marks all the extant child
    events as orphaned.
    
    We then avoid copying orphaned events; in order to avoid getting more
    of them.
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    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>
    Cc: fweisbec@gmail.com
    Link: http://lkml.kernel.org/r/20170316125823.289567442@infradead.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    d8a8cfc7
core.c 259 KB