[PATCH 02/15] kernel: Use trace_invoke_##name() at guarded tracepoint call sites

Vineeth Pillai (Google)
2026-03-12T15:05:42Z

Replace trace_foo() with the new trace_invoke_foo() at sites already
guarded by trace_foo_enabled(), avoiding a redundant
static_branch_unlikely() re-evaluation inside the tracepoint.
trace_invoke_foo() calls the tracepoint callbacks directly without
utilizing the static branch again.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vineeth Pillai (Google) <vineeth@bitbyteword.org>
Assisted-by: Claude:claude-sonnet-4-6
---
kernel/irq_work.c | 2 +-
kernel/sched/ext.c | 2 +-
kernel/smp.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index 73f7e1fd4ab4d..74e71b6434841 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -79,7 +79,7 @@ void __weak arch_irq_work_raise(void)
static __always_inline void irq_work_raise(struct irq_work *work)
{
if (trace_ipi_send_cpu_enabled() && arch_irq_work_has_interrupt())
- trace_ipi_send_cpu(smp_processor_id(), _RET_IP_, work->func);
+ trace_invoke_ipi_send_cpu(smp_processor_id(), _RET_IP_, work->func);

arch_irq_work_raise();
}
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 1594987d637b0..93b03d5a8d5b8 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4494,7 +4494,7 @@ static __printf(2, 3) void dump_line(struct seq_buf *s, const char *fmt, ...)
vscnprintf(line_buf, sizeof(line_buf), fmt, args);
va_end(args);

- trace_sched_ext_dump(line_buf);
+ trace_invoke_sched_ext_dump(line_buf);
}
#endif
/* @s may be zero sized and seq_buf triggers WARN if so */
diff --git a/kernel/smp.c b/kernel/smp.c
index f349960f79cad..da779fd78ffe7 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -394,7 +394,7 @@ void __smp_call_single_queue(int cpu, struct llist_node *node)
func = CSD_TYPE(csd) == CSD_TYPE_TTWU ?
sched_ttwu_pending : csd->func;

- trace_csd_queue_cpu(cpu, _RET_IP_, func, csd);
+ trace_invoke_csd_queue_cpu(cpu, _RET_IP_, func, csd);
}

/*
--
2.53.0