1 #ifndef __LINUX_CACHE_H
2 #define __LINUX_CACHE_H
4 #include <linux/kernel.h>
5 #include <linux/config.h>
9 #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
12 #ifndef SMP_CACHE_BYTES
13 #define SMP_CACHE_BYTES L1_CACHE_BYTES
20 #ifndef ____cacheline_aligned
21 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
24 #ifndef ____cacheline_aligned_in_smp
26 #define ____cacheline_aligned_in_smp ____cacheline_aligned
28 #define ____cacheline_aligned_in_smp
29 #endif /* CONFIG_SMP */
32 #ifndef __cacheline_aligned
33 #define __cacheline_aligned \
34 __attribute__((__aligned__(SMP_CACHE_BYTES), \
35 __section__(".data.cacheline_aligned")))
36 #endif /* __cacheline_aligned */
38 #ifndef __cacheline_aligned_in_smp
40 #define __cacheline_aligned_in_smp __cacheline_aligned
42 #define __cacheline_aligned_in_smp
43 #endif /* CONFIG_SMP */
47 * The maximum alignment needed for some critical structures
48 * These could be inter-node cacheline sizes/L3 cacheline
49 * size etc. Define this in asm/cache.h for your arch
51 #ifndef INTERNODE_CACHE_SHIFT
52 #define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT
55 #if !defined(____cacheline_internodealigned_in_smp)
56 #if defined(CONFIG_SMP)
57 #define ____cacheline_internodealigned_in_smp \
58 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
60 #define ____cacheline_internodealigned_in_smp
64 #endif /* __LINUX_CACHE_H */