Re: [PATCH v2] perf: Synchronously cleanup child events

From: Alexander Shishkin
Date: Fri Jan 22 2016 - 06:35:53 EST


Peter Zijlstra <peterz@xxxxxxxxxxxxx> writes:

> So I think there's a number of problems still :-(

Also, it does indeed race with
__perf_event_exit_task()/sync_child_event(), but that one I'd fix by
simply wrapping the sync_child_event()/free_event() in

mutex_lock(&parent_event->child_mutex);
if (!is_orphan_event(parent_event)) {
sync_child_event(child_event);
free_event(child_event);
}
mutex_unlock(&parent_event->child_event);

At some later point in time the code there could use a bit of
reshuffling, I guess.

Regards,
--
Alex