aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/lib.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-31 13:22:12 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-03-31 13:22:12 +0100
commited25dad906fd3bec60fa79bc124afb3e854d67f0 (patch)
tree02e99908dcbdf1f865a74dbb7ba0c592211bb15e /xen/include/xen/lib.h
parent3f64466b4bfbc47a9cb97416d7ed883606a329d2 (diff)
downloadxen-ed25dad906fd3bec60fa79bc124afb3e854d67f0.tar.gz
xen-ed25dad906fd3bec60fa79bc124afb3e854d67f0.tar.bz2
xen-ed25dad906fd3bec60fa79bc124afb3e854d67f0.zip
Use unlikely() in BUG_ON()/WARN_ON()
-fno-reorder-blocks was added in c/s 1712, when x86-64 just started to become enabled. The reason it got added is entirely unclear to me, and it prevents the intended effect of unlikely() constructs (in particular the ones added here) of moving out of line code which is expected to never get executed, as well as using forward branches (which are statically predicted taken by various processors' branch prediction units) preferably to reach infrequently executed code. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/xen/lib.h')
-rw-r--r--xen/include/xen/lib.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 93fdabb9f1..f5c21f64f7 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -12,8 +12,8 @@
void __bug(char *file, int line) __attribute__((noreturn));
void __warn(char *file, int line);
-#define BUG_ON(p) do { if (p) BUG(); } while (0)
-#define WARN_ON(p) do { if (p) WARN(); } while (0)
+#define BUG_ON(p) do { if (unlikely(p)) BUG(); } while (0)
+#define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); }))