jump_label: unlikely(x) > 0
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 12 Nov 2013 23:08:44 +0000 (15:08 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Nov 2013 03:09:13 +0000 (12:09 +0900)
if (unlikely(x) > 0) doesn't seem to help branch prediction

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/jump_label.h

index a5079072da663e6b1e426504c3dfa39438e42127..cf08540d62048db2a222b7ea35e8ccfe9632ece0 100644 (file)
@@ -132,14 +132,14 @@ static __always_inline void jump_label_init(void)
 
 static __always_inline bool static_key_false(struct static_key *key)
 {
-       if (unlikely(atomic_read(&key->enabled)) > 0)
+       if (unlikely(atomic_read(&key->enabled) > 0))
                return true;
        return false;
 }
 
 static __always_inline bool static_key_true(struct static_key *key)
 {
-       if (likely(atomic_read(&key->enabled)) > 0)
+       if (likely(atomic_read(&key->enabled) > 0))
                return true;
        return false;
 }