mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Shan Wei <davidshan@tencent.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	davidshan@tencent.com, rostedt@goodmis.org, cl@linux.com,
	tglx@linutronix.de
Subject: [tip:perf/core] tracing: Use __this_cpu_inc/ dec operation instead of __get_cpu_var
Date: Sun, 3 Feb 2013 11:18:05 -0800	[thread overview]
Message-ID: <tip-821465295b36136998ef294fe176fba4e09c1cd9@git.kernel.org> (raw)
In-Reply-To: <50A9C1BD.1060308@gmail.com>

Commit-ID:  821465295b36136998ef294fe176fba4e09c1cd9
Gitweb:     http://git.kernel.org/tip/821465295b36136998ef294fe176fba4e09c1cd9
Author:     Shan Wei <davidshan@tencent.com>
AuthorDate: Mon, 19 Nov 2012 13:21:01 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Fri, 25 Jan 2013 20:36:54 -0500

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>
---
 kernel/trace/trace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ca9b7df..07888e1 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1344,7 +1344,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
@@ -1398,7 +1398,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();
 
 }

      parent reply	other threads:[~2013-02-03 19:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19  5:21 [PATCH] trace: use __this_cpu_inc/dec " Shan Wei
2012-11-19 21:34 ` Christoph Lameter
2012-11-30  6:37 ` Shan Wei
2013-02-03 19:18 ` tip-bot for Shan Wei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-821465295b36136998ef294fe176fba4e09c1cd9@git.kernel.org \
    --to=davidshan@tencent.com \
    --cc=cl@linux.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome