diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-04-06 15:47:32 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-04-10 15:21:47 -0400 |
commit | 8aaf1ee70e19ac74cbbb81098edfa328d1ab4bd7 (patch) | |
tree | 5b0e3a0691a6a655b9d25b1812535344ccd6b08d /include/linux/ftrace.h | |
parent | 5367278cb7ba74537bcad1470d75f30d95b09c14 (diff) |
tracing: Rename trace_active to disable_stack_tracer and inline its modification
In order to eliminate a function call, make "trace_active" into
"disable_stack_tracer" and convert stack_tracer_disable() and friends into
static inline functions.
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r-- | include/linux/ftrace.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 7b4e6572ab21..06b2990a35e4 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -287,8 +287,40 @@ stack_trace_sysctl(struct ctl_table *table, int write, | |||
287 | void __user *buffer, size_t *lenp, | 287 | void __user *buffer, size_t *lenp, |
288 | loff_t *ppos); | 288 | loff_t *ppos); |
289 | 289 | ||
290 | void stack_tracer_disable(void); | 290 | /* DO NOT MODIFY THIS VARIABLE DIRECTLY! */ |
291 | void stack_tracer_enable(void); | 291 | DECLARE_PER_CPU(int, disable_stack_tracer); |
292 | |||
293 | /** | ||
294 | * stack_tracer_disable - temporarily disable the stack tracer | ||
295 | * | ||
296 | * There's a few locations (namely in RCU) where stack tracing | ||
297 | * cannot be executed. This function is used to disable stack | ||
298 | * tracing during those critical sections. | ||
299 | * | ||
300 | * This function must be called with preemption or interrupts | ||
301 | * disabled and stack_tracer_enable() must be called shortly after | ||
302 | * while preemption or interrupts are still disabled. | ||
303 | */ | ||
304 | static inline void stack_tracer_disable(void) | ||
305 | { | ||
306 | /* Preemption or interupts must be disabled */ | ||
307 | if (IS_ENABLED(CONFIG_PREEMPT_DEBUG)) | ||
308 | WARN_ON_ONCE(!preempt_count() || !irqs_disabled()); | ||
309 | this_cpu_inc(disable_stack_tracer); | ||
310 | } | ||
311 | |||
312 | /** | ||
313 | * stack_tracer_enable - re-enable the stack tracer | ||
314 | * | ||
315 | * After stack_tracer_disable() is called, stack_tracer_enable() | ||
316 | * must be called shortly afterward. | ||
317 | */ | ||
318 | static inline void stack_tracer_enable(void) | ||
319 | { | ||
320 | if (IS_ENABLED(CONFIG_PREEMPT_DEBUG)) | ||
321 | WARN_ON_ONCE(!preempt_count() || !irqs_disabled()); | ||
322 | this_cpu_dec(disable_stack_tracer); | ||
323 | } | ||
292 | #else | 324 | #else |
293 | static inline void stack_tracer_disable(void) { } | 325 | static inline void stack_tracer_disable(void) { } |
294 | static inline void stack_tracer_enable(void) { } | 326 | static inline void stack_tracer_enable(void) { } |