struct perf_event *event;
raw_spin_lock(&ctx->lock);
- perf_pmu_disable(ctx->pmu);
ctx->is_active = 0;
if (likely(!ctx->nr_events))
goto out;
if (!ctx->nr_active)
goto out;
+ perf_pmu_disable(ctx->pmu);
if (event_type & EVENT_PINNED) {
list_for_each_entry(event, &ctx->pinned_groups, group_entry)
group_sched_out(event, cpuctx, ctx);
list_for_each_entry(event, &ctx->flexible_groups, group_entry)
group_sched_out(event, cpuctx, ctx);
}
-out:
perf_pmu_enable(ctx->pmu);
+out:
raw_spin_unlock(&ctx->lock);
}