Messages in this thread Patch in this message | | | Date | Tue, 21 Feb 2012 15:03:01 -0500 | From | Jason Baron <> | Subject | [PATCH 03/10] jump label: introduce very_unlikely() |
| |
The 'static_branch()' construct can be thought of as stronger form of 'unlikely()'. Thus, let's rename 'static_branch()' -> 'very_unlikely()'. Leave around 'static_branch()' for a while until all users are converted, but mark it as deprecated.
It would be nice to locate 'very_unlikely()' in include/linux/compiler.h, where 'unlikely()' is defined, but I'm afraid there are too many additional headers that I'd have to pull into compiler.h.
Signed-off-by: Jason Baron <jbaron@redhat.com> --- include/linux/jump_label.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index f7c6958..563c781 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -72,6 +72,12 @@ struct module; #define JUMP_LABEL_INIT {ATOMIC_INIT(0), NULL} #endif +static __always_inline bool very_unlikely(struct jump_label_key *key) +{ + return arch_static_branch(key); +} + +/* Deprecated. Please use 'very_unlikely() instead. */ static __always_inline bool static_branch(struct jump_label_key *key) { return arch_static_branch(key); @@ -114,6 +120,14 @@ struct jump_label_key_deferred { struct jump_label_key key; }; +static __always_inline bool very_unlikely(struct jump_label_key *key) +{ + if (unlikely(atomic_read(&key->enabled))) + return true; + return false; +} + +/* Deprecated. Please use 'very_unlikely() instead. */ static __always_inline bool static_branch(struct jump_label_key *key) { if (unlikely(atomic_read(&key->enabled))) -- 1.7.7.5
| |