• Steven Rostedt (VMware)'s avatar
    ftrace: Make function trace pid filtering a bit more exact · 717e3f5e
    Steven Rostedt (VMware) authored
    The set_ftrace_pid file is used to filter function tracing to only trace
    tasks that are listed in that file. Instead of testing the pids listed in
    that file (it's a bitmask) at each function trace event, the logic is done
    via a sched_switch hook. A flag is set when the next task to run is in the
    list of pids in the set_ftrace_pid file. But the sched_switch hook is not at
    the exact location of when the task switches, and the flag gets set before
    the task to be traced actually runs. This leaves a residue of traced
    functions that do not belong to the pid that should be filtered on.
    
    By changing the logic slightly, where instead of having  a boolean flag to
    test, record the pid that should be traced, with special values for not to
    trace and always trace. Then at each function call, a check will be made to
    see if the function should be ignored, or if the current pid matches the
    function that should be traced, and only trace if it matches (or if it has
    the special value to always trace).
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    717e3f5e
ftrace.c 172 KB