ftrace: Make ftrace_graph_is_dead() a static branch
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 30 Mar 2022 07:00:19 +0000 (09:00 +0200)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sat, 2 Apr 2022 12:40:09 +0000 (08:40 -0400)
commit18bfee3216fa6f28d55ebf88d824a539d2bec3c7
tree57fb3d2d8b7a9b0620a51de3dbb8134fb9291db8
parentfcbf591cedbd44d82d7765b3c7e261858108593f
ftrace: Make ftrace_graph_is_dead() a static branch

ftrace_graph_is_dead() is used on hot paths, it just reads a variable
in memory and is not worth suffering function call constraints.

For instance, at entry of prepare_ftrace_return(), inlining it avoids
saving prepare_ftrace_return() parameters to stack and restoring them
after calling ftrace_graph_is_dead().

While at it using a static branch is even more performant and is
rather well adapted considering that the returned value will almost
never change.

Inline ftrace_graph_is_dead() and replace 'kill_ftrace_graph' bool
by a static branch.

The performance improvement is noticeable.

Link: https://lkml.kernel.org/r/e0411a6a0ed3eafff0ad2bc9cd4b0e202b4617df.1648623570.git.christophe.leroy@csgroup.eu
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
include/linux/ftrace.h
kernel/trace/fgraph.c