Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756031Ab2K3Gho (ORCPT ); Fri, 30 Nov 2012 01:37:44 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:60073 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755488Ab2K3Ghn (ORCPT ); Fri, 30 Nov 2012 01:37:43 -0500 Message-ID: <50B8542C.3010109@gmail.com> Date: Fri, 30 Nov 2012 14:37:32 +0800 From: Shan Wei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: rostedt@goodmis.org, fweisbec@gmail.com, mingo@redhat.com, Kernel-Maillist , Christoph Lameter Subject: Re: [PATCH] trace: use __this_cpu_inc/dec operation instead of __get_cpu_var References: <50A9C1BD.1060308@gmail.com> In-Reply-To: <50A9C1BD.1060308@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1426 Lines: 43 ping ...... Shan Wei said, at 2012/11/19 13:21: > From: Shan Wei > > __this_cpu_inc_return() or __this_cpu_dec generates a single instruction, > which is faster than __get_cpu_var operation. > > Signed-off-by: Shan Wei > --- > 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 18c0aa8..3795694 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -1313,7 +1313,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, > */ > preempt_disable_notrace(); > > - use_stack = ++__get_cpu_var(ftrace_stack_reserve); > + use_stack = __this_cpu_inc_return(ftrace_stack_reserve); > /* > * We don't need any atomic variables, just a barrier. > * If an interrupt comes in, we don't care, because it would > @@ -1367,7 +1367,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, > out: > /* Again, don't let gcc optimize things here */ > barrier(); > - __get_cpu_var(ftrace_stack_reserve)--; > + __this_cpu_dec(ftrace_stack_reserve); > preempt_enable_notrace(); > > } > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/