Source-Changes-HG archive

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

[src/trunk]: src/sys/kern pserialize(9): Micro-optimize pserialize_read_exit.



details:   https://anonhg.NetBSD.org/src/rev/f156f4c784f9
branches:  trunk
changeset: 374184:f156f4c784f9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Apr 09 08:28:24 2023 +0000

description:
pserialize(9): Micro-optimize pserialize_read_exit.

Most of the time we're not cold, so let's convince gcc to make that a
statically predicted-not-taken branch.

diffstat:

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

diffs (27 lines):

diff -r 8c6b30a918b3 -r f156f4c784f9 sys/kern/subr_pserialize.c
--- a/sys/kern/subr_pserialize.c        Sun Apr 09 08:18:03 2023 +0000
+++ b/sys/kern/subr_pserialize.c        Sun Apr 09 08:28:24 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pserialize.c,v 1.20 2023/04/09 08:17:45 riastradh Exp $   */
+/*     $NetBSD: subr_pserialize.c,v 1.21 2023/04/09 08:28:24 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.20 2023/04/09 08:17:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.21 2023/04/09 08:28:24 riastradh Exp $");
 
 #include <sys/param.h>
 
@@ -138,7 +138,7 @@ void
 pserialize_read_exit(int s)
 {
 
-       KASSERT((cold || kpreempt_disabled()));
+       KASSERT(__predict_false(cold) || kpreempt_disabled());
 
        __insn_barrier();
        if (__predict_false(curcpu()->ci_psz_read_depth-- == 0))



Home | Main Index | Thread Index | Old Index