1 #ifndef __LINUX_CACHE_H
2 #define __LINUX_CACHE_H
4 #include <linux/kernel.h>
8 #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
11 #ifndef SMP_CACHE_BYTES
12 #define SMP_CACHE_BYTES L1_CACHE_BYTES
19 #ifndef ____cacheline_aligned
20 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
23 #ifndef ____cacheline_aligned_in_smp
25 #define ____cacheline_aligned_in_smp ____cacheline_aligned
27 #define ____cacheline_aligned_in_smp
28 #endif /* CONFIG_SMP */
31 #ifndef __cacheline_aligned
32 #define __cacheline_aligned \
33 __attribute__((__aligned__(SMP_CACHE_BYTES), \
34 __section__(".data.cacheline_aligned")))
35 #endif /* __cacheline_aligned */
37 #ifndef __cacheline_aligned_in_smp
39 #define __cacheline_aligned_in_smp __cacheline_aligned
41 #define __cacheline_aligned_in_smp
42 #endif /* CONFIG_SMP */
46 * The maximum alignment needed for some critical structures
47 * These could be inter-node cacheline sizes/L3 cacheline
48 * size etc. Define this in asm/cache.h for your arch
50 #ifndef INTERNODE_CACHE_SHIFT
51 #define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT
54 #if !defined(____cacheline_internodealigned_in_smp)
55 #if defined(CONFIG_SMP)
56 #define ____cacheline_internodealigned_in_smp \
57 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
59 #define ____cacheline_internodealigned_in_smp
63 #ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE
64 #define cache_line_size() L1_CACHE_BYTES
67 #endif /* __LINUX_CACHE_H */