Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern pool(9): Tweak branch prediction in pool_cache_get_...
details: https://anonhg.NetBSD.org/src/rev/b50cf0c60254
branches: trunk
changeset: 374190:b50cf0c60254
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Apr 09 12:21:59 2023 +0000
description:
pool(9): Tweak branch prediction in pool_cache_get_paddr assertion.
No functional change intended.
diffstat:
sys/kern/subr_pool.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diffs (40 lines):
diff -r e8e8b6b8b917 -r b50cf0c60254 sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c Sun Apr 09 12:16:42 2023 +0000
+++ b/sys/kern/subr_pool.c Sun Apr 09 12:21:59 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_pool.c,v 1.289 2023/04/09 12:16:34 riastradh Exp $ */
+/* $NetBSD: subr_pool.c,v 1.290 2023/04/09 12:21:59 riastradh Exp $ */
/*
* Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.289 2023/04/09 12:16:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.290 2023/04/09 12:21:59 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -2705,10 +2705,17 @@ pool_cache_get_paddr(pool_cache_t pc, in
int s;
KASSERT(!(flags & PR_NOWAIT) != !(flags & PR_WAITOK));
- KASSERTMSG((!cpu_intr_p() && !cpu_softintr_p()) ||
- (pc->pc_pool.pr_ipl != IPL_NONE || cold || panicstr != NULL),
- "%s: [%s] is IPL_NONE, but called from interrupt context",
- __func__, pc->pc_pool.pr_wchan);
+ if (pc->pc_pool.pr_ipl == IPL_NONE &&
+ __predict_true(!cold) &&
+ __predict_true(panicstr == NULL)) {
+ KASSERTMSG(!cpu_intr_p(),
+ "%s: [%s] is IPL_NONE, but called from interrupt context",
+ __func__, pc->pc_pool.pr_wchan);
+ KASSERTMSG(!cpu_softintr_p(),
+ "%s: [%s] is IPL_NONE,"
+ " but called from soft interrupt context",
+ __func__, pc->pc_pool.pr_wchan);
+ }
if (flags & PR_WAITOK) {
ASSERT_SLEEPABLE();
Home |
Main Index |
Thread Index |
Old Index