Linux v2.6.15-rc6
[pohmelfs.git] / include / linux / cache.h
blob0b7ecf3af78a70a854cefbac1d7e814a5000baf5
1 #ifndef __LINUX_CACHE_H
2 #define __LINUX_CACHE_H
4 #include <linux/kernel.h>
5 #include <linux/config.h>
6 #include <asm/cache.h>
8 #ifndef L1_CACHE_ALIGN
9 #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
10 #endif
12 #ifndef SMP_CACHE_BYTES
13 #define SMP_CACHE_BYTES L1_CACHE_BYTES
14 #endif
16 #if defined(CONFIG_X86) || defined(CONFIG_SPARC64) || defined(CONFIG_IA64)
17 #define __read_mostly __attribute__((__section__(".data.read_mostly")))
18 #else
19 #define __read_mostly
20 #endif
22 #ifndef ____cacheline_aligned
23 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
24 #endif
26 #ifndef ____cacheline_aligned_in_smp
27 #ifdef CONFIG_SMP
28 #define ____cacheline_aligned_in_smp ____cacheline_aligned
29 #else
30 #define ____cacheline_aligned_in_smp
31 #endif /* CONFIG_SMP */
32 #endif
34 #ifndef __cacheline_aligned
35 #define __cacheline_aligned \
36 __attribute__((__aligned__(SMP_CACHE_BYTES), \
37 __section__(".data.cacheline_aligned")))
38 #endif /* __cacheline_aligned */
40 #ifndef __cacheline_aligned_in_smp
41 #ifdef CONFIG_SMP
42 #define __cacheline_aligned_in_smp __cacheline_aligned
43 #else
44 #define __cacheline_aligned_in_smp
45 #endif /* CONFIG_SMP */
46 #endif
48 #if !defined(____cacheline_maxaligned_in_smp)
49 #if defined(CONFIG_SMP)
50 #define ____cacheline_maxaligned_in_smp \
51 __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX))))
52 #else
53 #define ____cacheline_maxaligned_in_smp
54 #endif
55 #endif
57 #endif /* __LINUX_CACHE_H */