1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_CACHELINE_H
3 #define PERF_CACHELINE_H
5 #include <linux/compiler.h>
7 int __pure
cacheline_size(void);
11 * Some architectures have 'Adjacent Cacheline Prefetch' feature,
12 * which performs like the cacheline size being doubled.
14 static inline u64
cl_address(u64 address
, bool double_cl
)
16 u64 size
= cacheline_size();
21 /* return the cacheline of the address */
22 return (address
& ~(size
- 1));
25 static inline u64
cl_offset(u64 address
, bool double_cl
)
27 u64 size
= cacheline_size();
32 /* return the offset inside cacheline */
33 return (address
& (size
- 1));
36 #endif // PERF_CACHELINE_H