提交 9288f99a 编写于 作者: C Christoph Lameter 提交者: Tejun Heo

this_cpu: Use this_cpu_xx for ftrace

this_cpu_xx can reduce the instruction count here and also
avoid address arithmetic.
Signed-off-by: NChristoph Lameter <cl@linux-foundation.org>
Acked-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 494f6a9e
...@@ -86,17 +86,17 @@ static int dummy_set_flag(u32 old_flags, u32 bit, int set) ...@@ -86,17 +86,17 @@ static int dummy_set_flag(u32 old_flags, u32 bit, int set)
*/ */
static int tracing_disabled = 1; static int tracing_disabled = 1;
DEFINE_PER_CPU(local_t, ftrace_cpu_disabled); DEFINE_PER_CPU(int, ftrace_cpu_disabled);
static inline void ftrace_disable_cpu(void) static inline void ftrace_disable_cpu(void)
{ {
preempt_disable(); preempt_disable();
local_inc(&__get_cpu_var(ftrace_cpu_disabled)); __this_cpu_inc(per_cpu_var(ftrace_cpu_disabled));
} }
static inline void ftrace_enable_cpu(void) static inline void ftrace_enable_cpu(void)
{ {
local_dec(&__get_cpu_var(ftrace_cpu_disabled)); __this_cpu_dec(per_cpu_var(ftrace_cpu_disabled));
preempt_enable(); preempt_enable();
} }
...@@ -1085,7 +1085,7 @@ trace_function(struct trace_array *tr, ...@@ -1085,7 +1085,7 @@ trace_function(struct trace_array *tr,
struct ftrace_entry *entry; struct ftrace_entry *entry;
/* If we are reading the ring buffer, don't trace */ /* If we are reading the ring buffer, don't trace */
if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled)))) if (unlikely(__this_cpu_read(per_cpu_var(ftrace_cpu_disabled))))
return; return;
event = trace_buffer_lock_reserve(buffer, TRACE_FN, sizeof(*entry), event = trace_buffer_lock_reserve(buffer, TRACE_FN, sizeof(*entry),
......
...@@ -413,7 +413,7 @@ extern int DYN_FTRACE_TEST_NAME(void); ...@@ -413,7 +413,7 @@ extern int DYN_FTRACE_TEST_NAME(void);
extern int ring_buffer_expanded; extern int ring_buffer_expanded;
extern bool tracing_selftest_disabled; extern bool tracing_selftest_disabled;
DECLARE_PER_CPU(local_t, ftrace_cpu_disabled); DECLARE_PER_CPU(int, ftrace_cpu_disabled);
#ifdef CONFIG_FTRACE_STARTUP_TEST #ifdef CONFIG_FTRACE_STARTUP_TEST
extern int trace_selftest_startup_function(struct tracer *trace, extern int trace_selftest_startup_function(struct tracer *trace,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册