Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Use __predict_false to optimize, and also replace p...



details:   https://anonhg.NetBSD.org/src/rev/27def7dda3b7
branches:  trunk
changeset: 992316:27def7dda3b7
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Aug 24 14:04:27 2018 +0000

description:
Use __predict_false to optimize, and also replace panic->printf.

diffstat:

 sys/kern/subr_pool.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 4514106896ea -r 27def7dda3b7 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Fri Aug 24 11:43:13 2018 +0000
+++ b/sys/kern/subr_pool.c      Fri Aug 24 14:04:27 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.224 2018/08/23 12:18:02 maxv Exp $     */
+/*     $NetBSD: subr_pool.c,v 1.225 2018/08/24 14:04:27 maxv Exp $     */
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.224 2018/08/23 12:18:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.225 2018/08/24 14:04:27 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -2830,16 +2830,16 @@
 
        pat = pool_pattern_generate(cp);
        expected = (pat == '\0') ? STATIC_BYTE: pat;
-       if (expected != *cp) {
-               panic("%s: %p: 0x%02x != 0x%02x\n",
+       if (__predict_false(expected != *cp)) {
+               printf("%s: %p: 0x%02x != 0x%02x\n",
                   __func__, cp, *cp, expected);
        }
        cp++;
 
        while (cp < ep) {
                expected = pool_pattern_generate(cp);
-               if (*cp != expected) {
-                       panic("%s: %p: 0x%02x != 0x%02x\n",
+               if (__predict_false(*cp != expected)) {
+                       printf("%s: %p: 0x%02x != 0x%02x\n",
                           __func__, cp, *cp, expected);
                }
                cp++;



Home | Main Index | Thread Index | Old Index