• J
    perf: Add queued work to remove orphaned child events · fadfe7be
    Jiri Olsa 提交于
    In cases when the  owner task exits before the workload and the
    workload made some forks, all the events stay in until the last
    workload process exits. Thats' because each child event holds
    parent reference.
    
    We want to release all children events once the parent is gone,
    because at that time there's no process to read them anyway, so
    they're just eating resources.
    
    This removal  races with process exit, which removes all events
    and fork, which clone events.  To be clear of those two, adding
    work queue to remove orphaned child for context in case such
    event is detected.
    
    Using delayed work queue (with delay == 1), because we queue this
    work under perf scheduler callbacks. Normal work queue tries to wake
    up the queue process, which deadlocks on rq->lock in this place.
    
    Also preventing clones from abandoned parent event.
    Signed-off-by: NJiri Olsa <jolsa@kernel.org>
    Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: http://lkml.kernel.org/r/1406896382-18404-4-git-send-email-jolsa@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
    fadfe7be
core.c 191.5 KB