diff options
| author | riastradh <riastradh@NetBSD.org> | 2023-04-09 12:21:59 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2023-04-09 12:21:59 +0000 |
| commit | 4748edaaeccdfe559ef6478352e7cd421c2d0e56 (patch) | |
| tree | 2f65c3869bb002fd2c704e324393364bd53fb287 /sys/kern | |
| parent | 003a6c63fa4b9002ae0b73d717adccc574171cf6 (diff) | |
pool(9): Tweak branch prediction in pool_cache_get_paddr assertion.
No functional change intended.
Diffstat (limited to 'sys/kern')
| -rw-r--r-- | sys/kern/subr_pool.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 3c4b10b7934..b8f087979c5 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -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, int flags, paddr_t *pap) 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(); |
