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_{true,false} for panicstr checks
details: https://anonhg.NetBSD.org/src/rev/e8c79e752f62
branches: trunk
changeset: 373244:e8c79e752f62
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Jan 27 09:28:41 2023 +0000
description:
Sprinkle __predict_{true,false} for panicstr checks
diffstat:
sys/kern/kern_lock.c | 6 +++---
sys/kern/kern_mutex.c | 6 +++---
sys/kern/kern_rwlock.c | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diffs (90 lines):
diff -r 5a2dae46072d -r e8c79e752f62 sys/kern/kern_lock.c
--- a/sys/kern/kern_lock.c Thu Jan 26 22:20:16 2023 +0000
+++ b/sys/kern/kern_lock.c Fri Jan 27 09:28:41 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lock.c,v 1.181 2022/10/26 23:28:18 riastradh Exp $ */
+/* $NetBSD: kern_lock.c,v 1.182 2023/01/27 09:28:41 ozaki-r Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.181 2022/10/26 23:28:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.182 2023/01/27 09:28:41 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_lockdebug.h"
@@ -71,7 +71,7 @@
uint64_t pctr;
bool idle;
- if (panicstr != NULL) {
+ if (__predict_false(panicstr != NULL)) {
return;
}
diff -r 5a2dae46072d -r e8c79e752f62 sys/kern/kern_mutex.c
--- a/sys/kern/kern_mutex.c Thu Jan 26 22:20:16 2023 +0000
+++ b/sys/kern/kern_mutex.c Fri Jan 27 09:28:41 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_mutex.c,v 1.101 2022/12/05 07:09:04 skrll Exp $ */
+/* $NetBSD: kern_mutex.c,v 1.102 2023/01/27 09:28:41 ozaki-r Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#define __MUTEX_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.101 2022/12/05 07:09:04 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.102 2023/01/27 09:28:41 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -516,7 +516,7 @@
MUTEX_ASSERT(mtx, !cpu_intr_p());
MUTEX_WANTLOCK(mtx);
- if (panicstr == NULL) {
+ if (__predict_true(panicstr == NULL)) {
KDASSERT(pserialize_not_in_read_section());
LOCKDEBUG_BARRIER(&kernel_lock, 1);
}
diff -r 5a2dae46072d -r e8c79e752f62 sys/kern/kern_rwlock.c
--- a/sys/kern/kern_rwlock.c Thu Jan 26 22:20:16 2023 +0000
+++ b/sys/kern/kern_rwlock.c Fri Jan 27 09:28:41 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rwlock.c,v 1.66 2022/04/09 23:46:19 riastradh Exp $ */
+/* $NetBSD: kern_rwlock.c,v 1.67 2023/01/27 09:28:41 ozaki-r Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019, 2020
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.66 2022/04/09 23:46:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.67 2023/01/27 09:28:41 ozaki-r Exp $");
#include "opt_lockdebug.h"
@@ -197,7 +197,7 @@
rw_abort(const char *func, size_t line, krwlock_t *rw, const char *msg)
{
- if (panicstr != NULL)
+ if (__predict_false(panicstr != NULL))
return;
LOCKDEBUG_ABORT(func, line, rw, &rwlock_lockops, msg);
@@ -304,7 +304,7 @@
RW_ASSERT(rw, curthread != 0);
RW_WANTLOCK(rw, op);
- if (panicstr == NULL) {
+ if (__predict_true(panicstr == NULL)) {
KDASSERT(pserialize_not_in_read_section());
LOCKDEBUG_BARRIER(&kernel_lock, 1);
}
Home |
Main Index |
Thread Index |
Old Index