Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2008 15:58:28 +0200
From:      Andre Oppermann <andre@freebsd.org>
To:        gnn@freebsd.org
Cc:        arch@freebsd.org
Subject:   Re: Accounting for mbufs and clusters assigned to a socket buffer
Message-ID:  <4811E384.5020604@freebsd.org>
In-Reply-To: <m2bq3y6yk3.wl%gnn@neville-neil.com>
References:  <m2bq3y6yk3.wl%gnn@neville-neil.com>

next in thread | previous in thread | raw e-mail | index | archive | help
gnn@freebsd.org wrote:
> Howdy,
> 
> The following patch updates the kernel (CURRENT as of 23 April or so)
> and netstat(1) to show not only the bytes in the receive and send
> queues but also the mbuf and cluster usage per socket buffer.  I'd be
> interested in people's comments on this.  I'd like to extend such
> counting to show more information, in particular how much of a cluster
> or mbuf is actually in use.

The intent of tracking that information is good.  However there are some
problems with your approach: M_EXT does not mean the mbuf has a 2k cluster
attached.  It could by any external storage.  That is a 2k (classic) cluster,
a 4k (page size) cluster, a 9k cluster, a VM page (sendfile), and so on.

The field sb_mbcnt already gives you the aggregated gross storage space in
use for the socket.  And sb_cc tells how much actual payload it contains.

Just printing the already available sb_mbcnt in netstat is probably sufficient
to get a good real memory usage picture.  sb_mbcnt is already exported in xsb
and doesn't require a KPI change.

-- 
Andre




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4811E384.5020604>