public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jump_label: unlikely(x) > 0
@ 2013-10-11 20:50 Roel Kluin
  2013-10-11 20:57 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2013-10-11 20:50 UTC (permalink / raw)
  To: Andrew Jones, Raghavendra K T, Konrad Rzeszutek Wilk,
	H. Peter Anvin, Ingo Molnar, Andrew Morton, LKML

untested, but wasn't this intended instead?
--------------
if (unlikely(x) > 0) doesn't seem to help branch prediction

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index a507907..cf08540 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -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;
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-16  6:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11 20:50 [PATCH] jump_label: unlikely(x) > 0 Roel Kluin
2013-10-11 20:57 ` Andrew Morton
2013-10-15 16:53   ` H. Peter Anvin
2013-10-16  6:46     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox