Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern softint_execute(): don't hang onto the kernel_lock ...
details: https://anonhg.NetBSD.org/src/rev/2be014dd8e8b
branches: trunk
changeset: 744136:2be014dd8e8b
user: ad <ad%NetBSD.org@localhost>
date: Sat Jan 25 15:12:47 2020 +0000
description:
softint_execute(): don't hang onto the kernel_lock hold longer than
needed.
diffstat:
sys/kern/kern_softint.c | 28 +++++++++-------------------
1 files changed, 9 insertions(+), 19 deletions(-)
diffs (74 lines):
diff -r d433e9a83966 -r 2be014dd8e8b sys/kern/kern_softint.c
--- a/sys/kern/kern_softint.c Sat Jan 25 15:09:54 2020 +0000
+++ b/sys/kern/kern_softint.c Sat Jan 25 15:12:47 2020 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: kern_softint.c,v 1.57 2020/01/08 17:38:42 ad Exp $ */
+/* $NetBSD: kern_softint.c,v 1.58 2020/01/25 15:12:47 ad Exp $ */
/*-
- * Copyright (c) 2007, 2008, 2019 The NetBSD Foundation, Inc.
+ * Copyright (c) 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -170,7 +170,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.57 2020/01/08 17:38:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.58 2020/01/25 15:12:47 ad Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -544,7 +544,6 @@
softint_execute(softint_t *si, lwp_t *l, int s)
{
softhand_t *sh;
- bool havelock;
#ifdef __HAVE_FAST_SOFTINTS
KASSERT(si->si_lwp == curlwp);
@@ -555,8 +554,6 @@
KASSERT(si->si_lwp->l_wchan == NULL);
KASSERT(si->si_active);
- havelock = false;
-
/*
* Note: due to priority inheritance we may have interrupted a
* higher priority LWP. Since the soft interrupt must be quick
@@ -577,17 +574,14 @@
splx(s);
/* Run the handler. */
- if (sh->sh_flags & SOFTINT_MPSAFE) {
- if (havelock) {
- KERNEL_UNLOCK_ONE(l);
- havelock = false;
- }
- } else if (!havelock) {
+ if (__predict_true((sh->sh_flags & SOFTINT_MPSAFE) != 0)) {
+ (*sh->sh_func)(sh->sh_arg);
+ } else {
KERNEL_LOCK(1, l);
- havelock = true;
+ (*sh->sh_func)(sh->sh_arg);
+ KERNEL_UNLOCK_ONE(l);
}
- (*sh->sh_func)(sh->sh_arg);
-
+
/* Diagnostic: check that spin-locks have not leaked. */
KASSERTMSG(curcpu()->ci_mtx_count == 0,
"%s: ci_mtx_count (%d) != 0, sh_func %p\n",
@@ -603,10 +597,6 @@
PSREF_DEBUG_BARRIER();
- if (havelock) {
- KERNEL_UNLOCK_ONE(l);
- }
-
CPU_COUNT(CPU_COUNT_NSOFT, 1);
KASSERT(si->si_cpu == curcpu());
Home |
Main Index |
Thread Index |
Old Index