@@ -11845,7 +11845,6 @@ void perf_pmu_unregister(struct pmu *pmu)
synchronize_srcu(&pmus_srcu);
synchronize_rcu();
- free_percpu(pmu->pmu_disable_count);
idr_remove(&pmu_idr, pmu->type);
if (pmu_bus_running && pmu->dev && pmu->dev != PMU_NULL_DEV) {
if (pmu->nr_addr_filters)
@@ -11853,8 +11852,11 @@ void perf_pmu_unregister(struct pmu *pmu)
device_del(pmu->dev);
put_device(pmu->dev);
}
- free_pmu_context(pmu);
+
mutex_unlock(&pmus_lock);
+
+ free_percpu(pmu->pmu_disable_count);
+ free_pmu_context(pmu);
}
EXPORT_SYMBOL_GPL(perf_pmu_unregister);
It's not needed to hold the mutex to free the percpu variables stored in pmu. Move them outside of the mutex protection in preparation for possibly allowing them to live longer, according to the lifecycle of the object owning/containing the pmu. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> --- kernel/events/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)