From: Brian Gerst <brgerst@gmail.com>
To: tj@kernel.org
Cc: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] percpu: Optimize __get_cpu_var()
Date: Sat, 4 Sep 2010 13:21:11 -0400 [thread overview]
Message-ID: <1283620871-818-3-git-send-email-brgerst@gmail.com> (raw)
In-Reply-To: <1283620871-818-1-git-send-email-brgerst@gmail.com>
Redefine __get_cpu_var() using this_cpu_ptr() which can be
arch-optimized.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
include/asm-generic/percpu.h | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 5820fcb..c6e2c2d 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -55,10 +55,6 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
*/
#define per_cpu(var, cpu) \
(*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
-#define __get_cpu_var(var) \
- (*SHIFT_PERCPU_PTR(&(var), my_cpu_offset))
-#define __raw_get_cpu_var(var) \
- (*SHIFT_PERCPU_PTR(&(var), __my_cpu_offset))
#ifndef __this_cpu_ptr
#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
@@ -69,6 +65,9 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#define this_cpu_ptr(ptr) __this_cpu_ptr(ptr)
#endif
+#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
+#define __raw_get_cpu_var(var) (*__this_cpu_ptr(&(var)))
+
#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
extern void setup_per_cpu_areas(void);
#endif
--
1.7.2.2
next prev parent reply other threads:[~2010-09-04 17:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-04 17:21 PATCH [0/2] percpu: Local cpu pointer optimizations Brian Gerst
2010-09-04 17:21 ` [PATCH 1/2] x86, percpu: Optimize this_cpu_ptr Brian Gerst
2010-09-05 9:20 ` Tejun Heo
2010-09-04 17:21 ` Brian Gerst [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-09-07 11:41 PATCH [0/2] percpu: Local cpu pointer optimizations Brian Gerst
2010-09-07 11:41 ` [PATCH 2/2] percpu: Optimize __get_cpu_var() Brian Gerst
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=1283620871-818-3-git-send-email-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=x86@kernel.org \
/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