[PATCH 03/10] jump label: introduce very_unlikely()

From: Jason Baron
Date: Tue Feb 21 2012 - 15:03:21 EST


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@xxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/