1 #ifndef __LINUX_CACHE_H 2 #define __LINUX_CACHE_H 3 4 #include <linux/config.h> 5 #include <asm/cache.h> 6 7 #ifndef L1_CACHE_ALIGN 8 #define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)) 9 #endif 10 11 #ifndef SMP_CACHE_BYTES 12 #define SMP_CACHE_BYTES L1_CACHE_BYTES 13 #endif 14 15 #ifndef ____cacheline_aligned 16 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) 17 #endif 18 19 #ifndef ____cacheline_aligned_in_smp 20 #ifdef CONFIG_SMP 21 #define ____cacheline_aligned_in_smp ____cacheline_aligned 22 #else 23 #define ____cacheline_aligned_in_smp 24 #endif /* CONFIG_SMP */ 25 #endif 26 27 #ifndef __cacheline_aligned 28 #ifdef MODULE 29 #define __cacheline_aligned ____cacheline_aligned 30 #else 31 #define __cacheline_aligned \ 32 __attribute__((__aligned__(SMP_CACHE_BYTES), \ 33 __section__(".data.cacheline_aligned"))) 34 #endif 35 #endif /* __cacheline_aligned */ 36 37 #ifndef __cacheline_aligned_in_smp 38 #ifdef CONFIG_SMP 39 #define __cacheline_aligned_in_smp __cacheline_aligned 40 #else 41 #define __cacheline_aligned_in_smp 42 #endif /* CONFIG_SMP */ 43 #endif 44 45 #endif /* __LINUX_CACHE_H */ 46