|
@@ -3590,7 +3590,7 @@ static void unaccount_event(struct perf_event *event)
|
|
|
* 3) two matching events on the same context.
|
|
|
*
|
|
|
* The former two cases are handled in the allocation path (perf_event_alloc(),
|
|
|
- * __free_event()), the latter -- before the first perf_install_in_context().
|
|
|
+ * _free_event()), the latter -- before the first perf_install_in_context().
|
|
|
*/
|
|
|
static int exclusive_event_init(struct perf_event *event)
|
|
|
{
|
|
@@ -3665,29 +3665,6 @@ static bool exclusive_event_installable(struct perf_event *event,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-static void __free_event(struct perf_event *event)
|
|
|
-{
|
|
|
- if (!event->parent) {
|
|
|
- if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN)
|
|
|
- put_callchain_buffers();
|
|
|
- }
|
|
|
-
|
|
|
- perf_event_free_bpf_prog(event);
|
|
|
-
|
|
|
- if (event->destroy)
|
|
|
- event->destroy(event);
|
|
|
-
|
|
|
- if (event->ctx)
|
|
|
- put_ctx(event->ctx);
|
|
|
-
|
|
|
- if (event->pmu) {
|
|
|
- exclusive_event_destroy(event);
|
|
|
- module_put(event->pmu->module);
|
|
|
- }
|
|
|
-
|
|
|
- call_rcu(&event->rcu_head, free_event_rcu);
|
|
|
-}
|
|
|
-
|
|
|
static void _free_event(struct perf_event *event)
|
|
|
{
|
|
|
irq_work_sync(&event->pending);
|
|
@@ -3709,7 +3686,25 @@ static void _free_event(struct perf_event *event)
|
|
|
if (is_cgroup_event(event))
|
|
|
perf_detach_cgroup(event);
|
|
|
|
|
|
- __free_event(event);
|
|
|
+ if (!event->parent) {
|
|
|
+ if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN)
|
|
|
+ put_callchain_buffers();
|
|
|
+ }
|
|
|
+
|
|
|
+ perf_event_free_bpf_prog(event);
|
|
|
+
|
|
|
+ if (event->destroy)
|
|
|
+ event->destroy(event);
|
|
|
+
|
|
|
+ if (event->ctx)
|
|
|
+ put_ctx(event->ctx);
|
|
|
+
|
|
|
+ if (event->pmu) {
|
|
|
+ exclusive_event_destroy(event);
|
|
|
+ module_put(event->pmu->module);
|
|
|
+ }
|
|
|
+
|
|
|
+ call_rcu(&event->rcu_head, free_event_rcu);
|
|
|
}
|
|
|
|
|
|
/*
|