Skip to content

Commit 16052dd

Browse files
committed
ftrace: Add comment to why rcu_dereference_sched() is open coded
Because the function graph tracer can execute in sections where RCU is not "watching", the rcu_dereference_sched() for the has needs to be open coded. This is fine because the RCU "flavor" of the ftrace hash is protected by its own RCU handling (it does its own little synchronization on every CPU and does not rely on RCU sched). Acked-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent fd0e685 commit 16052dd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kernel/trace/trace.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,11 @@ static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace)
975975

976976
preempt_disable_notrace();
977977

978+
/*
979+
* Have to open code "rcu_dereference_sched()" because the
980+
* function graph tracer can be called when RCU is not
981+
* "watching".
982+
*/
978983
hash = rcu_dereference_protected(ftrace_graph_hash, !preemptible());
979984

980985
if (ftrace_hash_empty(hash)) {
@@ -1022,6 +1027,11 @@ static inline int ftrace_graph_notrace_addr(unsigned long addr)
10221027

10231028
preempt_disable_notrace();
10241029

1030+
/*
1031+
* Have to open code "rcu_dereference_sched()" because the
1032+
* function graph tracer can be called when RCU is not
1033+
* "watching".
1034+
*/
10251035
notrace_hash = rcu_dereference_protected(ftrace_graph_notrace_hash,
10261036
!preemptible());
10271037

0 commit comments

Comments
 (0)