Skip to content

Commit 8214652

Browse files
Shan Weirostedt
authored andcommitted
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/[email protected] Reviewed-by: Christoph Lameter <[email protected]> Signed-off-by: Shan Wei <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent d75f717 commit 8214652

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
13441344
*/
13451345
preempt_disable_notrace();
13461346

1347-
use_stack = ++__get_cpu_var(ftrace_stack_reserve);
1347+
use_stack = __this_cpu_inc_return(ftrace_stack_reserve);
13481348
/*
13491349
* We don't need any atomic variables, just a barrier.
13501350
* 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,
13981398
out:
13991399
/* Again, don't let gcc optimize things here */
14001400
barrier();
1401-
__get_cpu_var(ftrace_stack_reserve)--;
1401+
__this_cpu_dec(ftrace_stack_reserve);
14021402
preempt_enable_notrace();
14031403

14041404
}

0 commit comments

Comments
 (0)