perf/ftrace: Check for rcu_is_watching() in callback function
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 6 Nov 2020 02:32:44 +0000 (21:32 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 6 Nov 2020 13:42:05 +0000 (08:42 -0500)
commit5d029b035bf112466541b844ee1b86197936db65
tree40070ca454969abf0464abcbaed1ea1cb946e131
parent5d15a624c34b11c8d1c04c8cc004782e7ac2888d
perf/ftrace: Check for rcu_is_watching() in callback function

If a ftrace callback requires "rcu_is_watching", then it adds the
FTRACE_OPS_FL_RCU flag and it will not be called if RCU is not "watching".
But this means that it will use a trampoline when called, and this slows
down the function tracing a tad. By checking rcu_is_watching() from within
the callback, it no longer needs the RCU flag set in the ftrace_ops and it
can be safely called directly.

Link: https://lkml.kernel.org/r/20201028115613.591878956@goodmis.org
Link: https://lkml.kernel.org/r/20201106023547.711035826@goodmis.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_event_perf.c