The following commit has been merged into the perf/core branch of tip: Commit-ID: 3e15a3fe3a2a170c5be52783667706875c088f96 Gitweb: https://git.kernel.org/tip/3e15a3fe3a2a170c5be52783667706875c088f96 Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx> AuthorDate: Wed, 07 Aug 2024 13:29:29 +02:00 Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx> CommitterDate: Thu, 08 Aug 2024 12:27:32 +02:00 perf: Optimize __pmu_ctx_sched_out() 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@xxxxxxxxxxxxx> Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx> Reviewed-by: Namhyung Kim <namhyung@xxxxxxxxxx> Link: https://lore.kernel.org/r/20240807115550.392851915@xxxxxxxxxxxxx --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 197d3be..9893ba5 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -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);