Module Name: src
Committed By: riastradh
Date: Sun Apr 9 12:22:00 UTC 2023
Modified Files:
src/sys/kern: subr_pool.c
Log Message:
pool(9): Tweak branch prediction in pool_cache_get_paddr assertion.
No functional change intended.
To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/kern/subr_pool.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_pool.c
diff -u src/sys/kern/subr_pool.c:1.289 src/sys/kern/subr_pool.c:1.290
--- src/sys/kern/subr_pool.c:1.289 Sun Apr 9 12:16:34 2023
+++ src/sys/kern/subr_pool.c Sun Apr 9 12:21:59 2023
@@ -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();