]> git.ipfire.org Git - thirdparty/linux.git/commit
fgraph: Fix thresh_return nosleeptime double-adjust
authorShengming Hu <hu.shengming@zte.com.cn>
Sat, 21 Feb 2026 03:33:14 +0000 (11:33 +0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 4 Mar 2026 03:11:20 +0000 (22:11 -0500)
commitb96d0c59cdbb2a22b2545f6f3d5c6276b05761dd
tree0da70a04b14243c5731aa90cf5f04e559b579936
parent6ca8379b5d36e22b04e6315c3e49a6083377c862
fgraph: Fix thresh_return nosleeptime double-adjust

trace_graph_thresh_return() called handle_nosleeptime() and then delegated
to trace_graph_return(), which calls handle_nosleeptime() again. When
sleep-time accounting is disabled this double-adjusts calltime and can
produce bogus durations (including underflow).

Fix this by computing rettime once, applying handle_nosleeptime() only
once, using the adjusted calltime for threshold comparison, and writing
the return event directly via __trace_graph_return() when the threshold is
met.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260221113314048jE4VRwIyZEALiYByGK0My@zte.com.cn
Fixes: 3c9880f3ab52b ("ftrace: Use a running sleeptime instead of saving on shadow stack")
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_functions_graph.c