* [PATCH] selftest: vm: add unlikely() to BUG_ON()
@ 2018-08-31 21:24 ` igor.stoppa
0 siblings, 0 replies; 3+ messages in thread
From: Igor Stoppa @ 2018-08-31 21:24 UTC (permalink / raw)
To: Dmitry Safonov
Cc: igor.stoppa, Igor Stoppa, Shuah Khan, linux-kselftest, linux-kernel
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 --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); \
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] selftest: vm: add unlikely() to BUG_ON()
@ 2018-08-31 21:24 ` igor.stoppa
0 siblings, 0 replies; 3+ messages in thread
From: igor.stoppa @ 2018-08-31 21:24 UTC (permalink / raw)
BUG_ON() is unlikely() to BUG()
For unlikely(), borrow the definition from tools/include/linux/compiler.h
Signed-off-by: Igor Stoppa <igor.stoppa at huawei.com>
Cc: Dmitry Safonov <dima at arista.com>
Cc: Shuah Khan <shuah at kernel.org>
Cc: linux-kselftest at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
---
tools/testing/selftests/vm/map_populate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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); \
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] selftest: vm: add unlikely() to BUG_ON()
@ 2018-08-31 21:24 ` igor.stoppa
0 siblings, 0 replies; 3+ messages in thread
From: Igor Stoppa @ 2018-08-31 21:24 UTC (permalink / raw)
BUG_ON() is unlikely() to BUG()
For unlikely(), borrow the definition from tools/include/linux/compiler.h
Signed-off-by: Igor Stoppa <igor.stoppa at huawei.com>
Cc: Dmitry Safonov <dima at arista.com>
Cc: Shuah Khan <shuah at kernel.org>
Cc: linux-kselftest at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
---
tools/testing/selftests/vm/map_populate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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); \
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-08-31 21:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-31 21:24 [PATCH] selftest: vm: add unlikely() to BUG_ON() Igor Stoppa
2018-08-31 21:24 ` Igor Stoppa
2018-08-31 21:24 ` igor.stoppa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.