diff options
author | Jan Beulich <JBeulich@novell.com> | 2010-04-21 10:21:51 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-04-28 19:58:49 -0400 |
commit | 402af0d7c692ddcfa2333e93d3f275ebd0487926 (patch) | |
tree | 08d016caa7dc404d7400281b57fb634108b0291f /arch/x86/include/asm/percpu.h | |
parent | 1d16b0f2f3edf05f12a9e3960588e0d4854157bb (diff) |
x86, asm: Introduce and use percpu_inc()
... generating slightly smaller code.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
LKML-Reference: <4BCF261F020000780003B33C@vpn.id2.novell.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/include/asm/percpu.h')
-rw-r--r-- | arch/x86/include/asm/percpu.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 66a272dfd8b8..0ec6d12d84e6 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -190,6 +190,29 @@ do { \ | |||
190 | pfo_ret__; \ | 190 | pfo_ret__; \ |
191 | }) | 191 | }) |
192 | 192 | ||
193 | #define percpu_unary_op(op, var) \ | ||
194 | ({ \ | ||
195 | switch (sizeof(var)) { \ | ||
196 | case 1: \ | ||
197 | asm(op "b "__percpu_arg(0) \ | ||
198 | : "+m" (var)); \ | ||
199 | break; \ | ||
200 | case 2: \ | ||
201 | asm(op "w "__percpu_arg(0) \ | ||
202 | : "+m" (var)); \ | ||
203 | break; \ | ||
204 | case 4: \ | ||
205 | asm(op "l "__percpu_arg(0) \ | ||
206 | : "+m" (var)); \ | ||
207 | break; \ | ||
208 | case 8: \ | ||
209 | asm(op "q "__percpu_arg(0) \ | ||
210 | : "+m" (var)); \ | ||
211 | break; \ | ||
212 | default: __bad_percpu_size(); \ | ||
213 | } \ | ||
214 | }) | ||
215 | |||
193 | /* | 216 | /* |
194 | * percpu_read() makes gcc load the percpu variable every time it is | 217 | * percpu_read() makes gcc load the percpu variable every time it is |
195 | * accessed while percpu_read_stable() allows the value to be cached. | 218 | * accessed while percpu_read_stable() allows the value to be cached. |
@@ -207,6 +230,7 @@ do { \ | |||
207 | #define percpu_and(var, val) percpu_to_op("and", var, val) | 230 | #define percpu_and(var, val) percpu_to_op("and", var, val) |
208 | #define percpu_or(var, val) percpu_to_op("or", var, val) | 231 | #define percpu_or(var, val) percpu_to_op("or", var, val) |
209 | #define percpu_xor(var, val) percpu_to_op("xor", var, val) | 232 | #define percpu_xor(var, val) percpu_to_op("xor", var, val) |
233 | #define percpu_inc(var) percpu_unary_op("inc", var) | ||
210 | 234 | ||
211 | #define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) | 235 | #define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) |
212 | #define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) | 236 | #define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) |