view xen/include/xen/percpu.h @ 19964:3952eaeb70b0

Introduce and use a per-CPU read-mostly sub-section

Since mixing data that only gets setup once and then (perhaps
frequently) gets read by remote CPUs with data that the local CPU may
modify (again, perhaps frequently) still causes undesirable cache
protocol related bus traffic, separate the former class of objects
from the latter.

These objects converted here are just picked based on their write-once
(or write-very-rarely) properties; perhaps some more adjustments may
be desirable subsequently. The primary users of the new sub-section
will result from the next patch.

Signed-off-by: Jan Beulich <>
author Keir Fraser <>
date Mon Jul 13 11:32:41 2009 +0100 (2009-07-13)
parents f3fb7727cb9a
line source
1 #ifndef __XEN_PERCPU_H__
2 #define __XEN_PERCPU_H__
4 #include <xen/config.h>
5 #include <asm/percpu.h>
7 /*
8 * Separate out the type, so (int[3], foo) works.
9 *
10 * The _##name concatenation is being used here to prevent 'name' from getting
11 * macro expanded, while still allowing a per-architecture symbol name prefix.
12 */
13 #define DEFINE_PER_CPU(type, name) __DEFINE_PER_CPU(type, _##name, )
14 #define DEFINE_PER_CPU_READ_MOSTLY(type, name) \
15 __DEFINE_PER_CPU(type, _##name, .read_mostly)
17 /* Preferred on Xen. Also see arch-defined per_cpu(). */
18 #define this_cpu(var) __get_cpu_var(var)
20 /* Linux compatibility. */
21 #define get_cpu_var(var) this_cpu(var)
22 #define put_cpu_var(var)
24 #endif /* __XEN_PERCPU_H__ */