diff mbox series

selftest: vm: add unlikely() to BUG_ON()

Message ID 20180831212408.20071-1-igor.stoppa@huawei.com (mailing list archive)
State New
Headers show
Series selftest: vm: add unlikely() to BUG_ON() | expand

Commit Message

Igor Stoppa Aug. 31, 2018, 9:24 p.m. UTC
BUG_ON() is unlikely() to BUG()

For unlikely(), borrow the definition from tools/include/linux/compiler.h

Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Cc: Dmitry Safonov <dima@arista.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 tools/testing/selftests/vm/map_populate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/vm/map_populate.c b/tools/testing/selftests/vm/map_populate.c
index 6b8aeaa0bf7a..1bf8ff068dcd 100644
--- a/tools/testing/selftests/vm/map_populate.c
+++ b/tools/testing/selftests/vm/map_populate.c
@@ -21,9 +21,13 @@ 
 #define MMAP_SZ		4096
 #endif
 
+#ifndef unlikely
+# define unlikely(x)		__builtin_expect(!!(x), 0)
+#endif
+
 #define BUG_ON(condition, description)					\
 	do {								\
-		if (condition) {					\
+		if (unlikely(condition)) {				\
 			fprintf(stderr, "[FAIL]\t%s:%d\t%s:%s\n", __func__, \
 				__LINE__, (description), strerror(errno)); \
 			exit(1);					\