Merge branch 'perf/urgent' into perf/core, to pick up latest fixes and refresh the...
[sfrench/cifs-2.6.git] / arch / x86 / events / intel / lbr.c
index 0edda489cf3663350b5f50d006fdacb2a38ce61a..8a6bbacd17dcfb077e2a910b5b532c1d24a4a623 100644 (file)
@@ -383,8 +383,12 @@ static void __intel_pmu_lbr_save(struct x86_perf_task_context *task_ctx)
 
 void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool sched_in)
 {
+       struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
        struct x86_perf_task_context *task_ctx;
 
+       if (!cpuc->lbr_users)
+               return;
+
        /*
         * If LBR callstack feature is enabled and the stack was saved when
         * the task was scheduled out, restore the stack. Otherwise flush