perf: Optimize __pmu_ctx_sched_out()
authorPeter Zijlstra <peterz@infradead.org>
Wed, 7 Aug 2024 11:29:29 +0000 (13:29 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 8 Aug 2024 10:27:32 +0000 (12:27 +0200)
There is is no point in doing the perf_pmu_disable() dance just to do
nothing. This happens for ctx_sched_out(.type = EVENT_TIME) for
instance.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240807115550.392851915@infradead.org
kernel/events/core.c

index 197d3be443bbd4054f7b792babeb128f36237c22..9893ba5e98aa292f1526b7cf3685f58dcb7c097a 100644 (file)
@@ -3312,7 +3312,7 @@ static void __pmu_ctx_sched_out(struct perf_event_pmu_context *pmu_ctx,
                cpc->task_epc = NULL;
        }
 
-       if (!event_type)
+       if (!(event_type & EVENT_ALL))
                return;
 
        perf_pmu_disable(pmu);