Accounting for mbufs and clusters assigned to a socket buffer
gnn at freebsd.org
gnn at freebsd.org
Thu May 8 15:10:32 UTC 2008
At Wed, 07 May 2008 06:17:48 +0300,
Giorgos Keramidas wrote:
>
> I guess we could check *both* (m_flags & M_EXT) and m_ext.ext_type.
>
> This won't really show how many mbufs use a classic cluster vs. a 9k
> cluster, but checking for all the m_ext.ext_types is probably going to
> look a bit ugly in a single if-check :(
>
> We have at least EXT_CLUSTER, EXT_JUMBOP, EXT_JUMBO9, EXT_JUMBO16 and
> EXT_PACKET which may be interesting for cluster-related accounting, but
> in socketvar.h we can't really use the uma zone accounting. I just
> noticed that the 'interesting' ext_types are conveniently short integers
> though. Maybe we could change sb_ccnt to a small array, and then change
>
> if ((m)->m_flags & M_EXT) \
> (sb)->sb_ccnt += 1;
>
> to something like:
>
> if ((m)->m_flags & M_EXT && (m)->m_ext.ext_type < EXT_MBUF) \
> (sb)->sb_ccnt[(m)->m_ext.ext_type - 1] += 1; \
>
> With our current ext_type's
>
> #define EXT_CLUSTER 1 /* mbuf cluster */
> #define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */
> #define EXT_JUMBOP 3 /* jumbo cluster 4096 bytes */
> #define EXT_JUMBO9 4 /* jumbo cluster 9216 bytes */
> #define EXT_JUMBO16 5 /* jumbo cluster 16184 bytes */
> #define EXT_PACKET 6 /* mbuf+cluster from packet zone */
> #define EXT_MBUF 7 /* external mbuf reference (M_IOVEC) */
> ...
>
> the [ext_type - 1] would move the burden of parsing the ext_type at the
> place where we actually have to print something about the sb_ccnt
> counters.
>
> Would the 'bloat' of u_int[6] for ext_type's which are unused be too
> much to keep around?
I don't know if we want to go that far, but we could certainly try
it. I'll keep it in mind.
Thanks,
George
More information about the freebsd-arch
mailing list