1 #ifndef __LINUX_CACHE_H 2 #define __LINUX_CACHE_H 3 4 #include <linux/kernel.h> 5 #include <linux/config.h> 6 #include <asm/cache.h> 7 8 #ifndef L1_CACHE_ALIGN 9 #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES) 10 #endif 11 12 #ifndef SMP_CACHE_BYTES 13 #define SMP_CACHE_BYTES L1_CACHE_BYTES 14 #endif 15 16 #ifndef ____cacheline_aligned 17 #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) 18 #endif 19 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 27 28 #ifndef __cacheline_aligned 29 #define __cacheline_aligned \ 30 __attribute__((__aligned__(SMP_CACHE_BYTES), \ 31 __section__(".data.cacheline_aligned"))) 32 #endif /* __cacheline_aligned */ 33 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 41 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 50 51 #endif /* __LINUX_CACHE_H */ 52