diff --git a/kernel/events/core.c b/kernel/events/core.c index d4c85425e3a0f4c1bc08f5ca45ae53ac7742a9d3..adc3ef37b7e82e9987a71662057b23e7ae531a98 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -5716,6 +5716,7 @@ struct pmu *perf_init_event(struct perf_event *event) pmu = idr_find(&pmu_idr, event->attr.type); rcu_read_unlock(); if (pmu) { + event->pmu = pmu; ret = pmu->event_init(event); if (ret) pmu = ERR_PTR(ret); @@ -5723,6 +5724,7 @@ struct pmu *perf_init_event(struct perf_event *event) } list_for_each_entry_rcu(pmu, &pmus, entry) { + event->pmu = pmu; ret = pmu->event_init(event); if (!ret) goto unlock; @@ -5849,8 +5851,6 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, return ERR_PTR(err); } - event->pmu = pmu; - if (!event->parent) { if (event->attach_state & PERF_ATTACH_TASK) jump_label_inc(&perf_sched_events);