diff options
author | Jason Baron <jbaron@redhat.com> | 2012-02-28 13:49:01 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2012-02-28 14:01:08 -0500 |
commit | 8eedce996556d7d06522cd3a0e6069141c8dffe0 (patch) | |
tree | 1b24c85bd91fed430b3fbdec195fc1d35751e28f | |
parent | a706d4fc9e56d8e46393533e0cdca2d35fa5c7e5 (diff) |
static keys: Inline the static_key_enabled() function
In the jump label enabled case, calling static_key_enabled()
results in a function call. The function returns the results of
a compare, so it really doesn't need the overhead of a full
function call. Let's make it 'static inline' for both the jump
label enabled and disabled cases.
Signed-off-by: Jason Baron <jbaron@redhat.com>
Cc: a.p.zijlstra@chello.nl
Cc: rostedt@goodmis.org
Cc: mathieu.desnoyers@polymtl.ca
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/201202281849.q1SIn1p2023270@int-mx10.intmail.prod.int.phx2.redhat.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/jump_label.h | 11 | ||||
-rw-r--r-- | kernel/jump_label.c | 6 |
2 files changed, 5 insertions, 12 deletions
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index 2172da2d9bb4..c513a40510f5 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h | |||
@@ -127,7 +127,6 @@ extern int jump_label_text_reserved(void *start, void *end); | |||
127 | extern void static_key_slow_inc(struct static_key *key); | 127 | extern void static_key_slow_inc(struct static_key *key); |
128 | extern void static_key_slow_dec(struct static_key *key); | 128 | extern void static_key_slow_dec(struct static_key *key); |
129 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); | 129 | extern void static_key_slow_dec_deferred(struct static_key_deferred *key); |
130 | extern bool static_key_enabled(struct static_key *key); | ||
131 | extern void jump_label_apply_nops(struct module *mod); | 130 | extern void jump_label_apply_nops(struct module *mod); |
132 | extern void | 131 | extern void |
133 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); | 132 | jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); |
@@ -198,11 +197,6 @@ static inline int jump_label_text_reserved(void *start, void *end) | |||
198 | static inline void jump_label_lock(void) {} | 197 | static inline void jump_label_lock(void) {} |
199 | static inline void jump_label_unlock(void) {} | 198 | static inline void jump_label_unlock(void) {} |
200 | 199 | ||
201 | static inline bool static_key_enabled(struct static_key *key) | ||
202 | { | ||
203 | return (atomic_read(&key->enabled) > 0); | ||
204 | } | ||
205 | |||
206 | static inline int jump_label_apply_nops(struct module *mod) | 200 | static inline int jump_label_apply_nops(struct module *mod) |
207 | { | 201 | { |
208 | return 0; | 202 | return 0; |
@@ -224,4 +218,9 @@ jump_label_rate_limit(struct static_key_deferred *key, | |||
224 | #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE | 218 | #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE |
225 | #define jump_label_enabled static_key_enabled | 219 | #define jump_label_enabled static_key_enabled |
226 | 220 | ||
221 | static inline bool static_key_enabled(struct static_key *key) | ||
222 | { | ||
223 | return (atomic_read(&key->enabled) > 0); | ||
224 | } | ||
225 | |||
227 | #endif /* _LINUX_JUMP_LABEL_H */ | 226 | #endif /* _LINUX_JUMP_LABEL_H */ |
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index bf9dcadbb53a..43049192b5ec 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
@@ -29,12 +29,6 @@ void jump_label_unlock(void) | |||
29 | mutex_unlock(&jump_label_mutex); | 29 | mutex_unlock(&jump_label_mutex); |
30 | } | 30 | } |
31 | 31 | ||
32 | bool static_key_enabled(struct static_key *key) | ||
33 | { | ||
34 | return (atomic_read(&key->enabled) > 0); | ||
35 | } | ||
36 | EXPORT_SYMBOL_GPL(static_key_enabled); | ||
37 | |||
38 | static int jump_label_cmp(const void *a, const void *b) | 32 | static int jump_label_cmp(const void *a, const void *b) |
39 | { | 33 | { |
40 | const struct jump_entry *jea = a; | 34 | const struct jump_entry *jea = a; |