Re: [RFC PATCH 4/4] Documentation/ftrace: Document function comm filters
From: <hidden>
Date: 2026-08-31 10:52:34
Also in:
linux-doc, lkml
Randy wrote:
Hi,
Hi Randy,
On 8/30/26 4:12 AM, hu.shengming@zte.com.cn wrote:quoted
From: Shengming Hu <redacted> Document set_ftrace_comm and set_ftrace_notrace_comm, including their write and O_TRUNC behavior, accepted comm names, interaction with PID filters, and when a task is rechecked after its comm changes. Signed-off-by: Shengming Hu <redacted> --- Documentation/trace/ftrace.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst index 7261f25f8b4b..a96fc436ec16 100644 --- a/Documentation/trace/ftrace.rst +++ b/Documentation/trace/ftrace.rst@@ -313,6 +313,37 @@ of ftrace. Here is a list of some of the key files: If a PID is in both this file and "set_ftrace_pid", then this file takes precedence, and the thread will not be traced. + set_ftrace_comm: + + Have the function and function_graph tracers trace only threads whose + task comm is listed in this file. Names are matched exactly and must + contain between 1 and TASK_COMM_LEN - 1 bytes. + + Each write adds one name. A single trailing newline is ignored, while + embedded newlines are rejected. A zero-length write or a write containing + only a newline adds no entry. Duplicate entries have no effect. + + Opening the file with O_TRUNC clears the filter. Otherwise, writes addIs there a way to clear the filter from (in) a shell script?
Yes. It can be cleared with: # echo > set_ftrace_comm The shell opens the file with O_TRUNC, which clears the existing filter. I described the O_TRUNC behavior but overlooked the corresponding user-facing shell command. Thanks for pointing this out. Based on Masami's feedback, I am now considering reworking the series around a generic event trigger that updates set_ftrace_pid, so the comm-specific files may not remain in the next version. -- With Best Regards, Shengming