Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / linux / cache.h
blob4d767b93738a9461268910c87757c6f1fe7e5e4c
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 #ifndef ____cacheline_aligned
17 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
18 #endif
20 #ifndef ____cacheline_aligned_in_smp
21 #ifdef CONFIG_SMP
22 #define ____cacheline_aligned_in_smp ____cacheline_aligned
23 #else
24 #define ____cacheline_aligned_in_smp
25 #endif /* CONFIG_SMP */
26 #endif
28 #ifndef __cacheline_aligned
29 #define __cacheline_aligned \
30 __attribute__((__aligned__(SMP_CACHE_BYTES), \
31 __section__(".data.cacheline_aligned")))
32 #endif /* __cacheline_aligned */
34 #ifndef __cacheline_aligned_in_smp
35 #ifdef CONFIG_SMP
36 #define __cacheline_aligned_in_smp __cacheline_aligned
37 #else
38 #define __cacheline_aligned_in_smp
39 #endif /* CONFIG_SMP */
40 #endif
42 #if !defined(____cacheline_maxaligned_in_smp)
43 #if defined(CONFIG_SMP)
44 #define ____cacheline_maxaligned_in_smp \
45 __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX))))
46 #else
47 #define ____cacheline_maxaligned_in_smp
48 #endif
49 #endif
51 #endif /* __LINUX_CACHE_H */