Thread (11 messages) flat view 11 messages, 4 authors, 11d ago

Re: [RFC PATCH 0/4] ftrace: Add task comm filtering for function tracing

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2026-08-31 13:48:28
Also in: linux-trace-kernel, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help