Blame view
include/linux/prefetch.h
1.54 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/* * Generic cache management functions. Everything is arch-specific, * but this header exists to make sure the defines/functions can be * used in a generic way. * * 2000-11-13 Arjan van de Ven <arjan@fenrus.demon.nl> * */ #ifndef _LINUX_PREFETCH_H #define _LINUX_PREFETCH_H #include <linux/types.h> #include <asm/processor.h> #include <asm/cache.h> /* prefetch(x) attempts to pre-emptively get the memory pointed to by address "x" into the CPU L1 cache. prefetch(x) should not cause any kind of exception, prefetch(0) is specifically ok. prefetch() should be defined by the architecture, if not, the #define below provides a no-op define. There are 3 prefetch() macros: prefetch(x) - prefetches the cacheline at "x" for read prefetchw(x) - prefetches the cacheline at "x" for write |
521618457 fix typo in prefe... |
31 |
spin_lock_prefetch(x) - prefetches the spinlock *x for taking |
1da177e4c Linux-2.6.12-rc2 |
32 |
|
25985edce Fix common misspe... |
33 |
there is also PREFETCH_STRIDE which is the architecure-preferred |
1da177e4c Linux-2.6.12-rc2 |
34 35 36 |
"lookahead" size for prefetching streamed operations. */ |
1da177e4c Linux-2.6.12-rc2 |
37 |
#ifndef ARCH_HAS_PREFETCH |
ab483570a x86 & generic: ch... |
38 |
#define prefetch(x) __builtin_prefetch(x) |
1da177e4c Linux-2.6.12-rc2 |
39 40 41 |
#endif #ifndef ARCH_HAS_PREFETCHW |
ab483570a x86 & generic: ch... |
42 |
#define prefetchw(x) __builtin_prefetch(x,1) |
1da177e4c Linux-2.6.12-rc2 |
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
#endif #ifndef ARCH_HAS_SPINLOCK_PREFETCH #define spin_lock_prefetch(x) prefetchw(x) #endif #ifndef PREFETCH_STRIDE #define PREFETCH_STRIDE (4*L1_CACHE_BYTES) #endif static inline void prefetch_range(void *addr, size_t len) { #ifdef ARCH_HAS_PREFETCH char *cp; char *end = addr + len; for (cp = addr; cp < end; cp += PREFETCH_STRIDE) prefetch(cp); #endif } #endif |