Module Name:    src
Committed By:   riastradh
Date:           Sun Apr  9 08:28:25 UTC 2023

Modified Files:
        src/sys/kern: subr_pserialize.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/subr_pserialize.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_pserialize.c
diff -u src/sys/kern/subr_pserialize.c:1.20 src/sys/kern/subr_pserialize.c:1.21
--- src/sys/kern/subr_pserialize.c:1.20	Sun Apr  9 08:17:45 2023
+++ src/sys/kern/subr_pserialize.c	Sun Apr  9 08:28:24 2023
@@ -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))

Reply via email to