[PATCH 5/5] perf: Optimize __pmu_ctx_sched_out()

Peter Zijlstra
2024-08-07T11:56:27Z

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>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3304,7 +3304,7 @@ static void __pmu_ctx_sched_out(struct p
cpc->task_epc = NULL;
}

- if (!event_type)
+ if (!(event_type & EVENT_ALL))
return;

perf_pmu_disable(pmu);