Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Sprinkle __predict_false to dedicated assertions of...



details:   https://anonhg.NetBSD.org/src/rev/72a259cd2093
branches:  trunk
changeset: 366511:72a259cd2093
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Aug 31 01:23:57 2018 +0000

description:
Sprinkle __predict_false to dedicated assertions of mutex and rwlock

diffstat:

 sys/kern/kern_mutex.c  |  8 ++++----
 sys/kern/kern_rwlock.c |  8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 87c36cc3b066 -r 72a259cd2093 sys/kern/kern_mutex.c
--- a/sys/kern/kern_mutex.c     Thu Aug 30 22:39:54 2018 +0000
+++ b/sys/kern/kern_mutex.c     Fri Aug 31 01:23:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_mutex.c,v 1.74 2018/08/14 01:09:53 ozaki-r Exp $  */
+/*     $NetBSD: kern_mutex.c,v 1.75 2018/08/31 01:23:57 ozaki-r Exp $  */
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define        __MUTEX_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.74 2018/08/14 01:09:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.75 2018/08/31 01:23:57 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -96,7 +96,7 @@
 
 #define        MUTEX_DASSERT(mtx, cond)                                \
 do {                                                           \
-       if (!(cond))                                            \
+       if (__predict_false(!(cond)))                           \
                MUTEX_ABORT(mtx, "assertion failed: " #cond);   \
 } while (/* CONSTCOND */ 0);
 
@@ -110,7 +110,7 @@
 
 #define        MUTEX_ASSERT(mtx, cond)                                 \
 do {                                                           \
-       if (!(cond))                                            \
+       if (__predict_false(!(cond)))                           \
                MUTEX_ABORT(mtx, "assertion failed: " #cond);   \
 } while (/* CONSTCOND */ 0)
 
diff -r 87c36cc3b066 -r 72a259cd2093 sys/kern/kern_rwlock.c
--- a/sys/kern/kern_rwlock.c    Thu Aug 30 22:39:54 2018 +0000
+++ b/sys/kern/kern_rwlock.c    Fri Aug 31 01:23:57 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rwlock.c,v 1.51 2018/08/14 01:09:53 ozaki-r Exp $ */
+/*     $NetBSD: kern_rwlock.c,v 1.52 2018/08/31 01:23:57 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.51 2018/08/14 01:09:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.52 2018/08/31 01:23:57 ozaki-r Exp $");
 
 #define        __RWLOCK_PRIVATE
 
@@ -73,7 +73,7 @@
            (uintptr_t)__builtin_return_address(0), op == RW_READER);
 #define        RW_DASSERT(rw, cond)                                            \
 do {                                                                   \
-       if (!(cond))                                                    \
+       if (__predict_false(!(cond)))                                   \
                rw_abort(__func__, __LINE__, rw, "assertion failed: " #cond);\
 } while (/* CONSTCOND */ 0);
 
@@ -94,7 +94,7 @@
 
 #define        RW_ASSERT(rw, cond)                                             \
 do {                                                                   \
-       if (!(cond))                                                    \
+       if (__predict_false(!(cond)))                                   \
                rw_abort(__func__, __LINE__, rw, "assertion failed: " #cond);\
 } while (/* CONSTCOND */ 0)
 



Home | Main Index | Thread Index | Old Index