diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 9 | ||||
-rw-r--r-- | include/linux/compiler.h | 24 |
2 files changed, 8 insertions, 25 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 3b46ae464933..8bccb49981e5 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -46,12 +46,9 @@ | |||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #ifdef CONFIG_TRACE_BRANCH_PROFILING | 48 | #ifdef CONFIG_TRACE_BRANCH_PROFILING |
49 | #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_likely_profile) = .; \ | 49 | #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \ |
50 | *(_ftrace_likely) \ | 50 | *(_ftrace_annotated_branch) \ |
51 | VMLINUX_SYMBOL(__stop_likely_profile) = .; \ | 51 | VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .; |
52 | VMLINUX_SYMBOL(__start_unlikely_profile) = .; \ | ||
53 | *(_ftrace_unlikely) \ | ||
54 | VMLINUX_SYMBOL(__stop_unlikely_profile) = .; | ||
55 | #else | 52 | #else |
56 | #define LIKELY_PROFILE() | 53 | #define LIKELY_PROFILE() |
57 | #endif | 54 | #endif |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index c25e525121f0..0628a2013fae 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -77,32 +77,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
77 | #define likely_notrace(x) __builtin_expect(!!(x), 1) | 77 | #define likely_notrace(x) __builtin_expect(!!(x), 1) |
78 | #define unlikely_notrace(x) __builtin_expect(!!(x), 0) | 78 | #define unlikely_notrace(x) __builtin_expect(!!(x), 0) |
79 | 79 | ||
80 | #define likely_check(x) ({ \ | 80 | #define __branch_check__(x, expect) ({ \ |
81 | int ______r; \ | 81 | int ______r; \ |
82 | static struct ftrace_branch_data \ | 82 | static struct ftrace_branch_data \ |
83 | __attribute__((__aligned__(4))) \ | 83 | __attribute__((__aligned__(4))) \ |
84 | __attribute__((section("_ftrace_likely"))) \ | 84 | __attribute__((section("_ftrace_annotated_branch"))) \ |
85 | ______f = { \ | 85 | ______f = { \ |
86 | .func = __func__, \ | 86 | .func = __func__, \ |
87 | .file = __FILE__, \ | 87 | .file = __FILE__, \ |
88 | .line = __LINE__, \ | 88 | .line = __LINE__, \ |
89 | }; \ | 89 | }; \ |
90 | ______r = likely_notrace(x); \ | 90 | ______r = likely_notrace(x); \ |
91 | ftrace_likely_update(&______f, ______r, 1); \ | 91 | ftrace_likely_update(&______f, ______r, expect); \ |
92 | ______r; \ | ||
93 | }) | ||
94 | #define unlikely_check(x) ({ \ | ||
95 | int ______r; \ | ||
96 | static struct ftrace_branch_data \ | ||
97 | __attribute__((__aligned__(4))) \ | ||
98 | __attribute__((section("_ftrace_unlikely"))) \ | ||
99 | ______f = { \ | ||
100 | .func = __func__, \ | ||
101 | .file = __FILE__, \ | ||
102 | .line = __LINE__, \ | ||
103 | }; \ | ||
104 | ______r = unlikely_notrace(x); \ | ||
105 | ftrace_likely_update(&______f, ______r, 0); \ | ||
106 | ______r; \ | 92 | ______r; \ |
107 | }) | 93 | }) |
108 | 94 | ||
@@ -112,10 +98,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
112 | * written by Daniel Walker. | 98 | * written by Daniel Walker. |
113 | */ | 99 | */ |
114 | # ifndef likely | 100 | # ifndef likely |
115 | # define likely(x) (__builtin_constant_p(x) ? !!(x) : likely_check(x)) | 101 | # define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1)) |
116 | # endif | 102 | # endif |
117 | # ifndef unlikely | 103 | # ifndef unlikely |
118 | # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : unlikely_check(x)) | 104 | # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) |
119 | # endif | 105 | # endif |
120 | #else | 106 | #else |
121 | # define likely(x) __builtin_expect(!!(x), 1) | 107 | # define likely(x) __builtin_expect(!!(x), 1) |