Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Avoid allocating unused softints that share a value...



details:   https://anonhg.NetBSD.org/src/rev/4effed4a9885
branches:  trunk
changeset: 359222:4effed4a9885
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Feb 05 02:51:08 2018 +0000

description:
Avoid allocating unused softints that share a value of IPL between another

diffstat:

 sys/kern/subr_xcall.c |  19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r bff902169c6c -r 4effed4a9885 sys/kern/subr_xcall.c
--- a/sys/kern/subr_xcall.c     Mon Feb 05 02:49:46 2018 +0000
+++ b/sys/kern/subr_xcall.c     Mon Feb 05 02:51:08 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_xcall.c,v 1.23 2018/02/05 02:49:46 ozaki-r Exp $  */
+/*     $NetBSD: subr_xcall.c,v 1.24 2018/02/05 02:51:08 ozaki-r Exp $  */
 
 /*-
  * Copyright (c) 2007-2010 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.23 2018/02/05 02:49:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_xcall.c,v 1.24 2018/02/05 02:51:08 ozaki-r Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -154,6 +154,7 @@
        mutex_init(&xchi->xc_lock, MUTEX_DEFAULT, IPL_SOFTSERIAL);
        cv_init(&xchi->xc_busy, "xchicv");
 
+       /* Set up a softint for each IPL_SOFT*. */
 #define SETUP_SOFTINT(xipl, sipl) do {                                 \
                xc_sihs[(xipl)] = softint_establish( (sipl) | SOFTINT_MPSAFE,\
                    xc__highpri_intr, NULL);                            \
@@ -161,9 +162,20 @@
        } while (0)
 
        SETUP_SOFTINT(XC_IPL_SOFTSERIAL, SOFTINT_SERIAL);
+       /*
+        * If a IPL_SOFTXXX have the same value of the previous, we don't use
+        * the IPL (see xc_encode_ipl).  So we don't need to allocate a softint
+        * for it.
+        */
+#if IPL_SOFTNET != IPL_SOFTSERIAL
+       SETUP_SOFTINT(XC_IPL_SOFTNET, SOFTINT_NET);
+#endif
+#if IPL_SOFTBIO != IPL_SOFTNET
        SETUP_SOFTINT(XC_IPL_SOFTBIO, SOFTINT_BIO);
+#endif
+#if IPL_SOFTCLOCK != IPL_SOFTBIO
        SETUP_SOFTINT(XC_IPL_SOFTCLOCK, SOFTINT_CLOCK);
-       SETUP_SOFTINT(XC_IPL_SOFTNET, SOFTINT_NET);
+#endif
 
 #undef SETUP_SOFTINT
 
@@ -399,6 +411,7 @@
        xc_state_t *xc = & xc_high_pri;
 
        KASSERT(xc->xc_ipl < __arraycount(xc_sihs));
+       KASSERT(xc_sihs[xc->xc_ipl] != NULL);
 
        /* Executes xc__highpri_intr() via software interrupt. */
        softint_schedule(xc_sihs[xc->xc_ipl]);



Home | Main Index | Thread Index | Old Index