diff options
Diffstat (limited to 'include/linux/compiler.h')
| -rw-r--r-- | include/linux/compiler.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index d95da1020f1c..04fb5135b4e1 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -68,6 +68,7 @@ struct ftrace_branch_data { | |||
| 68 | unsigned long miss; | 68 | unsigned long miss; |
| 69 | unsigned long hit; | 69 | unsigned long hit; |
| 70 | }; | 70 | }; |
| 71 | unsigned long miss_hit[2]; | ||
| 71 | }; | 72 | }; |
| 72 | }; | 73 | }; |
| 73 | 74 | ||
| @@ -75,7 +76,8 @@ struct ftrace_branch_data { | |||
| 75 | * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code | 76 | * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code |
| 76 | * to disable branch tracing on a per file basis. | 77 | * to disable branch tracing on a per file basis. |
| 77 | */ | 78 | */ |
| 78 | #if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING) | 79 | #if defined(CONFIG_TRACE_BRANCH_PROFILING) \ |
| 80 | && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__) | ||
| 79 | void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | 81 | void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); |
| 80 | 82 | ||
| 81 | #define likely_notrace(x) __builtin_expect(!!(x), 1) | 83 | #define likely_notrace(x) __builtin_expect(!!(x), 1) |
| @@ -113,7 +115,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 113 | * "Define 'is'", Bill Clinton | 115 | * "Define 'is'", Bill Clinton |
| 114 | * "Define 'if'", Steven Rostedt | 116 | * "Define 'if'", Steven Rostedt |
| 115 | */ | 117 | */ |
| 116 | #define if(cond) if (__builtin_constant_p((cond)) ? !!(cond) : \ | 118 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) |
| 119 | #define __trace_if(cond) \ | ||
| 120 | if (__builtin_constant_p((cond)) ? !!(cond) : \ | ||
| 117 | ({ \ | 121 | ({ \ |
| 118 | int ______r; \ | 122 | int ______r; \ |
| 119 | static struct ftrace_branch_data \ | 123 | static struct ftrace_branch_data \ |
| @@ -125,10 +129,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 125 | .line = __LINE__, \ | 129 | .line = __LINE__, \ |
| 126 | }; \ | 130 | }; \ |
| 127 | ______r = !!(cond); \ | 131 | ______r = !!(cond); \ |
| 128 | if (______r) \ | 132 | ______f.miss_hit[______r]++; \ |
| 129 | ______f.hit++; \ | ||
| 130 | else \ | ||
| 131 | ______f.miss++; \ | ||
| 132 | ______r; \ | 133 | ______r; \ |
| 133 | })) | 134 | })) |
| 134 | #endif /* CONFIG_PROFILE_ALL_BRANCHES */ | 135 | #endif /* CONFIG_PROFILE_ALL_BRANCHES */ |
| @@ -260,6 +261,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
| 260 | # define __section(S) __attribute__ ((__section__(#S))) | 261 | # define __section(S) __attribute__ ((__section__(#S))) |
| 261 | #endif | 262 | #endif |
| 262 | 263 | ||
| 264 | /* Are two types/vars the same type (ignoring qualifiers)? */ | ||
| 265 | #ifndef __same_type | ||
| 266 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ||
| 267 | #endif | ||
| 268 | |||
| 263 | /* | 269 | /* |
| 264 | * Prevent the compiler from merging or refetching accesses. The compiler | 270 | * Prevent the compiler from merging or refetching accesses. The compiler |
| 265 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | 271 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), |
