Is it safe to invoke rcu_dereference() outside RCU critical sections in the kernel?
by pappasbrent from LinuxQuestions.org on (#6HS9A)
Hi all,
I have been reading the Linux kernel's RCU API documentation, and the docs seem to indicate that it is incorrect to call rcu_dereference() outside of an RCU read-side critical section (i.e., a section of code that begins with a call to rcu_read_lock() and ends with a call to rcu_read_unlock()).
However, I found several instances in the Linux kernel where this macro is invoked outside of a critical section.
Here is an example taken from line 5004 of net/mac80211/tx.c:
Code:resp = rcu_dereference(link->u.ap.probe_resp);Since this call to rcu_dereference() is outside a critical section, is it therefore erroneous?
Or am I misunderstanding how the RCU API works?
I have been reading the Linux kernel's RCU API documentation, and the docs seem to indicate that it is incorrect to call rcu_dereference() outside of an RCU read-side critical section (i.e., a section of code that begins with a call to rcu_read_lock() and ends with a call to rcu_read_unlock()).
However, I found several instances in the Linux kernel where this macro is invoked outside of a critical section.
Here is an example taken from line 5004 of net/mac80211/tx.c:
Code:resp = rcu_dereference(link->u.ap.probe_resp);Since this call to rcu_dereference() is outside a critical section, is it therefore erroneous?
Or am I misunderstanding how the RCU API works?