mbuf usage for an idle machine

Robert Watson rwatson at freebsd.org
Wed Aug 27 08:43:29 PDT 2003


On Wed, 27 Aug 2003, Giovanni P. Tirloni wrote:

>  I've been reading about mbufs and how they're used for
>  holding network packets and socket buffers and the
>  output of 'netstat -m' for a idle machine I've here
>  made me curious about how FreeBSD handles it in -CURRENT. 
> 
>  Why is it using so many mbufs when it's idle? My
>  small kwnowledge doesn't permit me to answer this
>  question yet ;) 

There are a number of situations in which the mbuf allocator is used to
allocate non-mbufs -- for example, we use mbufs to hold IP fragment
queues, as well as some static packet prototype mbufs, socket options,
etc.  I'd like to eliminate at least a few of these by replacing the use
with the existing kernel allocator, which would reduce the "spurious" mbuf
use.  The other typical source of mbufs that are never free'd are mbuf
leaks, but the allocations you have right now look low enough that it's
not that, I suspect.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Network Associates Laboratories


> 
>  root at gate:~# netstat -m
>  mbuf usage:
>          GEN cache:      0/0 (in use/in pool)
>          CPU #0 cache:   130/288 (in use/in pool)
>          Total:          130/288 (in use/in pool)
>          Mbuf cache high watermark: 512
>          Maximum possible: 9856
>          Allocated mbuf types:
>            130 mbufs allocated to data
>          2% of mbuf map consumed
>  mbuf cluster usage:
>          GEN cache:      0/8 (in use/in pool)
>          CPU #0 cache:   128/256 (in use/in pool)
>          Total:          128/264 (in use/in pool)
>          Cluster cache high watermark: 128
>          Maximum possible: 4928
>          5% of cluster map consumed
>  600 KBytes of wired memory reserved (48% in use)
>  0 requests for memory denied
>  0 requests for memory delayed
>  0 calls to protocol drain routines
> 
>  root at gate:~# sockstat -4c
>  USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
>  bs2      sshd       2085  4  tcp4   192.168.200.1:22      200.200.200.200:1405
>  root     sshd       2082  4  tcp4   192.168.200.1:22      200.200.200.200:1405
> 
>  root at gate:~# sockstat -4l
>  USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
>  root     mpd        635   14 tcp4   192.168.200.1:1723    *:*
>  nobody   squid      614   4  udp4   *:49184               *:*
>  nobody   squid      614   20 tcp4   127.0.0.1:3128        *:*
>  root     dhcpd      469   6  udp4   *:67                  *:*
>  root     sendmail   432   3  tcp4   127.0.0.1:25          *:*
>  root     sshd       426   3  tcp4   *:22                  *:*
>  root     ntpd       407   4  udp4   *:123                 *:*
>  root     ntpd       407   5  udp4   192.168.0.254:123     *:*
>  root     ntpd       407   6  udp4   192.168.200.1:123     *:*
>  root     ntpd       407   7  udp4   127.0.0.1:123         *:*
>  bind     named      292   4  udp4   *:49152               *:*
>  bind     named      292   20 udp4   192.168.0.254:53      *:*
>  bind     named      292   21 tcp4   192.168.0.254:53      *:*
>  bind     named      292   22 udp4   127.0.0.1:53          *:*
>  bind     named      292   23 tcp4   127.0.0.1:53          *:*
> 
>  FreeBSD gate 5.1-CURRENT FreeBSD 5.1-CURRENT #4: Wed Jul 23 \
>   11:22:55 BRT 2003     root at gate:/usr/src/sys/i386/compile/ \
>   GATE  i386
> 
>  It has 2 ethernet interfaces (192.168.200.1 and 192.168.0.254)
> 
>  I'll be happy to provide any additional information if it's
>  needed. 
> 
>  --
>  Giovanni P. Tirloni
>  http://www.tirloni.org
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> 



More information about the freebsd-net mailing list