On Sun, 30 Aug 2026 19:07:43 +0800 (CST)
[off-list ref] wrote:
Hi Steven and Masami,
This series adds two comm-based task filters for the function and
function_graph tracers:
set_ftrace_comm
set_ftrace_notrace_comm
I'd like to avoid adding more files like this. If anything, I would love to
add triggers to the function tracers.
Function tracing currently supports selecting tasks by PID. This makes
it difficult to configure tracing before a service starts, because it
does not have a PID yet. It is also inconvenient to keep tracing the
same service across restarts, as its PID may change. This use case was
suggested by Xuxin, a KSM reviewer.
I've always recommended a simple wrapper script for applications:
echo '#! /bin/bash
echo $$ > /sys/kernel/tracing/set_ftrace_pid
echo $$ > /sys/kernel/tracing/set_event_pid
exec "$@"' > trace-me.sh
chmod +x trace-me.sh
./trace-me.sh command to be traced
The above will do what you want.
But if we really do want to add more filters to function tracing, then
adding triggers to it would be the way to go.
-- Steve