diff options
author | Shan Wei <davidshan@tencent.com> | 2012-11-19 00:21:01 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-01-25 20:36:54 -0500 |
commit | 821465295b36136998ef294fe176fba4e09c1cd9 (patch) | |
tree | 241bf19a408130332b123780b55fc8303fee491b /kernel/trace/trace.c | |
parent | d75f717e19fe595e7efbf67de195ada8d89dfbbe (diff) |
tracing: Use __this_cpu_inc/dec operation instead of __get_cpu_var
__this_cpu_inc_return() or __this_cpu_dec generates a single instruction,
which is faster than __get_cpu_var operation.
Link: http://lkml.kernel.org/r/50A9C1BD.1060308@gmail.com
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Shan Wei <davidshan@tencent.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ca9b7dfed8ef..07888e15c694 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1344,7 +1344,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, | |||
1344 | */ | 1344 | */ |
1345 | preempt_disable_notrace(); | 1345 | preempt_disable_notrace(); |
1346 | 1346 | ||
1347 | use_stack = ++__get_cpu_var(ftrace_stack_reserve); | 1347 | use_stack = __this_cpu_inc_return(ftrace_stack_reserve); |
1348 | /* | 1348 | /* |
1349 | * We don't need any atomic variables, just a barrier. | 1349 | * We don't need any atomic variables, just a barrier. |
1350 | * If an interrupt comes in, we don't care, because it would | 1350 | * If an interrupt comes in, we don't care, because it would |
@@ -1398,7 +1398,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, | |||
1398 | out: | 1398 | out: |
1399 | /* Again, don't let gcc optimize things here */ | 1399 | /* Again, don't let gcc optimize things here */ |
1400 | barrier(); | 1400 | barrier(); |
1401 | __get_cpu_var(ftrace_stack_reserve)--; | 1401 | __this_cpu_dec(ftrace_stack_reserve); |
1402 | preempt_enable_notrace(); | 1402 | preempt_enable_notrace(); |
1403 | 1403 | ||
1404 | } | 1404 | } |