diff options
Diffstat (limited to 'tools/testing/radix-tree/linux/kernel.h')
-rw-r--r-- | tools/testing/radix-tree/linux/kernel.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h index be98a47b4e1b..9b43b4975d83 100644 --- a/tools/testing/radix-tree/linux/kernel.h +++ b/tools/testing/radix-tree/linux/kernel.h | |||
@@ -8,9 +8,14 @@ | |||
8 | #include <limits.h> | 8 | #include <limits.h> |
9 | 9 | ||
10 | #include "../../include/linux/compiler.h" | 10 | #include "../../include/linux/compiler.h" |
11 | #include "../../include/linux/err.h" | ||
11 | #include "../../../include/linux/kconfig.h" | 12 | #include "../../../include/linux/kconfig.h" |
12 | 13 | ||
14 | #ifdef BENCHMARK | ||
15 | #define RADIX_TREE_MAP_SHIFT 6 | ||
16 | #else | ||
13 | #define RADIX_TREE_MAP_SHIFT 3 | 17 | #define RADIX_TREE_MAP_SHIFT 3 |
18 | #endif | ||
14 | 19 | ||
15 | #ifndef NULL | 20 | #ifndef NULL |
16 | #define NULL 0 | 21 | #define NULL 0 |
@@ -43,4 +48,17 @@ static inline int in_interrupt(void) | |||
43 | { | 48 | { |
44 | return 0; | 49 | return 0; |
45 | } | 50 | } |
51 | |||
52 | /* | ||
53 | * This looks more complex than it should be. But we need to | ||
54 | * get the type for the ~ right in round_down (it needs to be | ||
55 | * as wide as the result!), and we want to evaluate the macro | ||
56 | * arguments just once each. | ||
57 | */ | ||
58 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ||
59 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | ||
60 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | ||
61 | |||
62 | #define xchg(ptr, x) uatomic_xchg(ptr, x) | ||
63 | |||
46 | #endif /* _KERNEL_H */ | 64 | #endif /* _KERNEL_H */ |