aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2013-11-04 20:27:36 -0500
committerSteven Rostedt <rostedt@goodmis.org>2013-11-05 16:04:08 -0500
commit9418fb208059d6f916bdb116653e166c5db9456d (patch)
tree670e2fdf2f79a0291307f872d82a365f2cb8f3d5
parent44847da1b921f35b348ecd46df93abfbcd547355 (diff)
rcu: Do not trace rcu_is_watching() functions
As perf uses the rcu_read_lock() primitives for recording into its ring buffer, perf tracing can not be called when RCU in inactive. With the perf function tracing, there are functions that can be traced when RCU is not active, and perf must not have its function callback called when this is the case. Luckily, Paul McKenney has created a way to detect when RCU is active or not with the rcu_is_watching() function. Unfortunately, this function can also be traced, and if that happens it can cause a bit of overhead for the perf function calls that do the check. Recursion protection prevents anything bad from happening, but there is a bit of added overhead for every function being traced that must detect that the rcu_is_watching() is also being traced. As rcu_is_watching() is a helper routine and not part of the critical logic in RCU, it does not need to be traced in order to debug RCU itself. Add the "notrace" annotation to all the rcu_is_watching() calls such that we never trace it. Link: http://lkml.kernel.org/r/20131104202736.72dd8e45@gandalf.local.home Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/rcutiny.c2
-rw-r--r--kernel/rcutree.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c
index 0fa061dfa55d..590c8a82aa00 100644
--- a/kernel/rcutiny.c
+++ b/kernel/rcutiny.c
@@ -179,7 +179,7 @@ EXPORT_SYMBOL_GPL(rcu_irq_enter);
179/* 179/*
180 * Test whether RCU thinks that the current CPU is idle. 180 * Test whether RCU thinks that the current CPU is idle.
181 */ 181 */
182bool __rcu_is_watching(void) 182bool notrace __rcu_is_watching(void)
183{ 183{
184 return rcu_dynticks_nesting; 184 return rcu_dynticks_nesting;
185} 185}
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 981d0c15a389..499bb2b2198c 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -662,7 +662,7 @@ void rcu_nmi_exit(void)
662 * rcu_is_watching(), the caller of __rcu_is_watching() must have at 662 * rcu_is_watching(), the caller of __rcu_is_watching() must have at
663 * least disabled preemption. 663 * least disabled preemption.
664 */ 664 */
665bool __rcu_is_watching(void) 665bool notrace __rcu_is_watching(void)
666{ 666{
667 return atomic_read(this_cpu_ptr(&rcu_dynticks.dynticks)) & 0x1; 667 return atomic_read(this_cpu_ptr(&rcu_dynticks.dynticks)) & 0x1;
668} 668}
@@ -673,7 +673,7 @@ bool __rcu_is_watching(void)
673 * If the current CPU is in its idle loop and is neither in an interrupt 673 * If the current CPU is in its idle loop and is neither in an interrupt
674 * or NMI handler, return true. 674 * or NMI handler, return true.
675 */ 675 */
676bool rcu_is_watching(void) 676bool notrace rcu_is_watching(void)
677{ 677{
678 int ret; 678 int ret;
679 679