Source-Changes-HG archive

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

[src/trunk]: src Add MBUFTRACE kernel option.



details:   https://anonhg.NetBSD.org/src/rev/90f5ff6cca50
branches:  trunk
changeset: 543469:90f5ff6cca50
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Feb 26 06:31:08 2003 +0000

description:
Add MBUFTRACE kernel option.
Do a little mbuf rework while here.  Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *).  These are not performance critical and making them
call m_get saves considerable space.  Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.

diffstat:

 doc/CHANGES               |    7 ++-
 sys/conf/files            |    3 +-
 sys/conf/osrelease.sh     |    4 +-
 sys/dev/ic/gem.c          |    6 +-
 sys/dev/ic/i82557.c       |    7 +-
 sys/dev/ic/pdq_ifsubr.c   |    5 +-
 sys/dev/ic/sgec.c         |    5 +-
 sys/dev/ic/tulip.c        |    7 +-
 sys/dev/kttcp.c           |    8 +-
 sys/kern/uipc_domain.c    |   11 +++-
 sys/kern/uipc_mbuf.c      |   84 ++++++++++++++++++++++++++++++++-
 sys/kern/uipc_socket.c    |   16 ++++-
 sys/kern/uipc_socket2.c   |   37 ++++++++++++--
 sys/kern/uipc_syscalls.c  |   35 +++++++++----
 sys/kern/uipc_usrreq.c    |    8 +-
 sys/net/bpf.c             |   10 +--
 sys/net/if.h              |    3 +-
 sys/net/if_ether.h        |   20 +++++--
 sys/net/if_ethersubr.c    |   25 ++++++++-
 sys/net/if_fddisubr.c     |   17 +++++-
 sys/net/if_loop.c         |   13 ++++-
 sys/net/if_sl.c           |    8 +-
 sys/net/if_strip.c        |    8 +-
 sys/net/ppp_tty.c         |    6 +-
 sys/net/rtsock.c          |   10 ++-
 sys/netatalk/ddp_output.c |   11 +---
 sys/netinet/if_arp.c      |    9 ++-
 sys/netinet/ip_icmp.c     |    6 +-
 sys/netinet/ip_input.c    |   23 ++++++++-
 sys/netinet/ip_mroute.c   |    5 +-
 sys/netinet/ip_output.c   |   12 +++-
 sys/netinet/ip_var.h      |    6 +-
 sys/netinet/raw_ip.c      |    5 +-
 sys/netinet/tcp_input.c   |    8 ++-
 sys/netinet/tcp_output.c  |    6 +-
 sys/netinet/tcp_subr.c    |   17 +++++-
 sys/netinet/tcp_usrreq.c  |   10 +++-
 sys/netinet/tcp_var.h     |    8 ++-
 sys/netinet/udp_usrreq.c  |   21 +++++++-
 sys/netiso/if_cons.c      |    6 +-
 sys/netiso/tp_output.c    |    6 +-
 sys/netiso/tp_usrreq.c    |    6 +-
 sys/netsmb/smb_trantcp.c  |    6 +-
 sys/nfs/krpc_subr.c       |    6 +-
 sys/nfs/nfs.h             |    3 +-
 sys/nfs/nfs_bootdhcp.c    |    6 +-
 sys/nfs/nfs_nqlease.c     |   20 +++---
 sys/nfs/nfs_serv.c        |   50 ++++++++++---------
 sys/nfs/nfs_socket.c      |   38 ++++++++++----
 sys/nfs/nfs_srvcache.c    |    6 +-
 sys/nfs/nfs_subs.c        |   47 +++++++++++-------
 sys/nfs/nfs_syscalls.c    |   15 +++--
 sys/nfs/nfs_vfsops.c      |   10 ++-
 sys/nfs/nfs_vnops.c       |   44 ++++++++--------
 sys/nfs/nfsm_subs.h       |   11 ++-
 sys/sys/domain.h          |    4 +-
 sys/sys/mbuf.h            |  116 +++++++++++++++++++++++++++++++++++++++++++--
 sys/sys/param.h           |    4 +-
 sys/sys/socketvar.h       |   72 ++++++++++++++-------------
 usr.bin/netstat/main.c    |    8 +-
 usr.bin/netstat/mbuf.c    |  105 +++++++++++++++++++++++++++++++++++++++--
 usr.bin/netstat/netstat.h |    3 +-
 62 files changed, 809 insertions(+), 293 deletions(-)

diffs (truncated from 3691 to 300 lines):

diff -r a8de048dfc63 -r 90f5ff6cca50 doc/CHANGES
--- a/doc/CHANGES       Wed Feb 26 06:21:09 2003 +0000
+++ b/doc/CHANGES       Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-LIST OF CHANGES FROM LAST RELEASE:                     <$Revision: 1.103 $>
+LIST OF CHANGES FROM LAST RELEASE:                     <$Revision: 1.104 $>
 
 
 [Note: This file does not mention every change made to the NetBSD source tree.
@@ -290,3 +290,8 @@
                [jhawk 20030221]
        kernel: Add LFSv2 support to libsa [simonb 20030324]
        i386: Add LFS support to bootblocks [simonb 20030324]
+       kernel: Add MBUFTRACE kernel option.  Change all MGET*(...M_WAIT,...)
+               to m_get*(M_WAIT, ...) to shrink kernel.  Add m_clget 
+               analogue to MCLGET and use it if M_WAIT is passed.  Adapt
+               netinet, if_loop, gem, tulip, fxp driver to MBUFTRACE.  Bump
+               version to 1.6P.  [matt 20030226]
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/conf/files
--- a/sys/conf/files    Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/conf/files    Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.601 2003/02/20 22:16:06 atatat Exp $
+#      $NetBSD: files,v 1.602 2003/02/26 06:31:08 matt Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -14,6 +14,7 @@
 # (note, these are case-sensitive)
 #
 defflag                                INSECURE
+defflag                                MBUFTRACE
 defflag                                KMEMSTATS
 defflag                                KTRACE
 defflag                                SYSTRACE
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/conf/osrelease.sh
--- a/sys/conf/osrelease.sh     Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/conf/osrelease.sh     Wed Feb 26 06:31:08 2003 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: osrelease.sh,v 1.91 2003/02/17 23:48:09 perseant Exp $
+#      $NetBSD: osrelease.sh,v 1.92 2003/02/26 06:31:08 matt Exp $
 #
 # Copyright (c) 1997 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -42,7 +42,7 @@
 #      sys/sys/param.h:        __NetBSD_Version__
 #      share/tmac/doc-common:  ds oS
 #
-release=1.6O
+release=1.6P
 
 case $1 in
 -s)
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/dev/ic/gem.c
--- a/sys/dev/ic/gem.c  Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/dev/ic/gem.c  Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gem.c,v 1.25 2003/02/20 00:55:21 matt Exp $ */
+/*     $NetBSD: gem.c,v 1.26 2003/02/26 06:31:09 matt Exp $ */
 
 /*
  * 
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.25 2003/02/20 00:55:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.26 2003/02/26 06:31:09 matt Exp $");
 
 #include "bpfilter.h"
 
@@ -1047,6 +1047,7 @@
                                    sc->sc_dev.dv_xname);
                                break;
                        }
+                       MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
                        if (m0->m_pkthdr.len > MHLEN) {
                                MCLGET(m, M_DONTWAIT);
                                if ((m->m_flags & M_EXT) == 0) {
@@ -1503,6 +1504,7 @@
        if (m == NULL)
                return (ENOBUFS);
 
+       MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
        MCLGET(m, M_DONTWAIT);
        if ((m->m_flags & M_EXT) == 0) {
                m_freem(m);
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c       Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/dev/ic/i82557.c       Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82557.c,v 1.72 2003/02/04 17:50:53 thorpej Exp $      */
+/*     $NetBSD: i82557.c,v 1.73 2003/02/26 06:31:09 matt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.72 2003/02/04 17:50:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.73 2003/02/26 06:31:09 matt Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -887,6 +887,7 @@
                                    sc->sc_dev.dv_xname);
                                break;
                        }
+                       MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
                        if (m0->m_pkthdr.len > MHLEN) {
                                MCLGET(m, M_DONTWAIT);
                                if ((m->m_flags & M_EXT) == 0) {
@@ -1206,6 +1207,7 @@
                        MGETHDR(m0, M_DONTWAIT, MT_DATA);
                        if (m == NULL)
                                goto dropit;
+                       MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
                        memcpy(mtod(m0, caddr_t),
                            mtod(m, caddr_t), len);
                        FXP_INIT_RFABUF(sc, m);
@@ -1830,6 +1832,7 @@
        if (m == NULL)
                return (ENOBUFS);
 
+       MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
        MCLGET(m, M_DONTWAIT);
        if ((m->m_flags & M_EXT) == 0) {
                m_freem(m);
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/dev/ic/pdq_ifsubr.c
--- a/sys/dev/ic/pdq_ifsubr.c   Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/dev/ic/pdq_ifsubr.c   Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pdq_ifsubr.c,v 1.39 2002/03/05 04:12:58 itojun Exp $   */
+/*     $NetBSD: pdq_ifsubr.c,v 1.40 2003/02/26 06:31:10 matt Exp $     */
 
 /*-
  * Copyright (c) 1995, 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pdq_ifsubr.c,v 1.39 2002/03/05 04:12:58 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pdq_ifsubr.c,v 1.40 2003/02/26 06:31:10 matt Exp $");
 
 #ifdef __NetBSD__
 #include "opt_inet.h"
@@ -792,6 +792,7 @@
         m_free(m);
        return NULL;
     }
+    MCLAIM(m, &PDQ_FDDICOM(sc)->ec_rx_mowner);
     m->m_pkthdr.len = m->m_len = PDQ_OS_DATABUF_SIZE;
 
     if (bus_dmamap_create(sc->sc_dmatag, PDQ_OS_DATABUF_SIZE,
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/dev/ic/sgec.c
--- a/sys/dev/ic/sgec.c Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/dev/ic/sgec.c Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sgec.c,v 1.21 2003/01/15 22:05:38 bouyer Exp $ */
+/*      $NetBSD: sgec.c,v 1.22 2003/02/26 06:31:10 matt Exp $ */
 /*
  * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.21 2003/01/15 22:05:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgec.c,v 1.22 2003/02/26 06:31:10 matt Exp $");
 
 #include "opt_inet.h"
 #include "bpfilter.h"
@@ -563,6 +563,7 @@
        if (m == NULL)
                return (ENOBUFS);
 
+       MCLAIM(m, &sc->sc_ec.ec_rx_mowner);
        MCLGET(m, M_DONTWAIT);
        if ((m->m_flags & M_EXT) == 0) {
                m_freem(m);
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/dev/ic/tulip.c        Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.121 2002/10/08 15:05:35 minoura Exp $      */
+/*     $NetBSD: tulip.c,v 1.122 2003/02/26 06:31:10 matt Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.121 2002/10/08 15:05:35 minoura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.122 2003/02/26 06:31:10 matt Exp $");
 
 #include "bpfilter.h"
 
@@ -755,6 +755,7 @@
                                    sc->sc_dev.dv_xname);
                                break;
                        }
+                       MCLAIM(m, &sc->sc_ethercom.ec_tx_mowner);
                        if (m0->m_pkthdr.len > MHLEN) {
                                MCLGET(m, M_DONTWAIT);
                                if ((m->m_flags & M_EXT) == 0) {
@@ -1324,6 +1325,7 @@
                            rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
                        continue;
                }
+               MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
                if (len > (MHLEN - 2)) {
                        MCLGET(m, M_DONTWAIT);
                        if ((m->m_flags & M_EXT) == 0) {
@@ -2289,6 +2291,7 @@
        if (m == NULL)
                return (ENOBUFS);
 
+       MCLAIM(m, &sc->sc_ethercom.ec_rx_mowner);
        MCLGET(m, M_DONTWAIT);
        if ((m->m_flags & M_EXT) == 0) {
                m_freem(m);
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/dev/kttcp.c
--- a/sys/dev/kttcp.c   Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/dev/kttcp.c   Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kttcp.c,v 1.8 2003/02/25 23:29:14 briggs Exp $ */
+/*     $NetBSD: kttcp.c,v 1.9 2003/02/26 06:31:09 matt Exp $   */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -288,16 +288,16 @@
                do {
                        do {
                                if (top == 0) {
-                                       MGETHDR(m, M_WAIT, MT_DATA);
+                                       m = m_gethdr(M_WAIT, MT_DATA);
                                        mlen = MHLEN;
                                        m->m_pkthdr.len = 0;
                                        m->m_pkthdr.rcvif = (struct ifnet *)0;
                                } else {
-                                       MGET(m, M_WAIT, MT_DATA);
+                                       m = m_get(M_WAIT, MT_DATA);
                                        mlen = MLEN;
                                }
                                if (resid >= MINCLSIZE && space >= MCLBYTES) {
-                                       MCLGET(m, M_WAIT);
+                                       m_clget(m, M_WAIT);
                                        if ((m->m_flags & M_EXT) == 0)
                                                goto nopages;
                                        mlen = MCLBYTES;
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/kern/uipc_domain.c
--- a/sys/kern/uipc_domain.c    Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/kern/uipc_domain.c    Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_domain.c,v 1.37 2002/05/12 20:36:58 matt Exp $    */
+/*     $NetBSD: uipc_domain.c,v 1.38 2003/02/26 06:31:11 matt Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.37 2002/05/12 20:36:58 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.38 2003/02/26 06:31:11 matt Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -128,6 +128,13 @@
        for (dp = domains; dp; dp = dp->dom_next) {
                if (dp->dom_init)
                        (*dp->dom_init)();
+#ifdef MBUFTRACE
+               if (dp->dom_mowner.mo_name[0] == '\0') {
+                       strncpy(dp->dom_mowner.mo_name, dp->dom_name,
+                           sizeof(dp->dom_mowner.mo_name));
+                       MOWNER_ATTACH(&dp->dom_mowner);
+               }
+#endif
                for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
                        if (pr->pr_init)
                                (*pr->pr_init)();
diff -r a8de048dfc63 -r 90f5ff6cca50 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Wed Feb 26 06:21:09 2003 +0000
+++ b/sys/kern/uipc_mbuf.c      Wed Feb 26 06:31:08 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.63 2003/02/01 06:23:44 thorpej Exp $   */
+/*     $NetBSD: uipc_mbuf.c,v 1.64 2003/02/26 06:31:11 matt Exp $      */
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.63 2003/02/01 06:23:44 thorpej Exp $");



Home | Main Index | Thread Index | Old Index