NetBSD-Bugs archive

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

kern/53439: mbuf allocation count should be changed from u_short to u_long (for netstat and systat)



>Number:         53439
>Category:       kern
>Synopsis:       mbuf allocation count should be changed from u_short to u_long (for netstat and systat)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 10 09:35:00 +0000 2018
>Originator:     Masanobu SAITOH
>Release:        NetBSD 8.99.21
>Organization:
>Environment:
Any
>Description:
	On a big machine, a lot of mbufs is allocated
	(e.g. ixgbe with many core CPU).

	% netstat -m
	2 mbufs in use:
	        2 mbufs allocated to data
	0 calls to protocol drain routines
	% vmstat -m | grep ^mb
	mbpl         512    74745    0        0  9346     0  9346  9346     2   inf    2

	vmstat says 74745 mbufs are allocated by netstat -m (and systat mbufs)
	says only two mbufs are allocated.

>How-To-Repeat:
	Run netstat on 40 core machine with two ixg.
>Fix:
	struct mbstat {
	        u_long  _m_spare;       /* formerly m_mbufs */
	        u_long  _m_spare1;      /* formerly m_clusters */
	        u_long  _m_spare2;      /* spare field */
	        u_long  _m_spare3;      /* formely m_clfree - free clusters */
	        u_long  m_drops;        /* times failed to find space */
	        u_long  m_wait;         /* times waited for space */
	        u_long  m_drain;        /* times drained protocols for space */
	        u_short m_mtypes[256];  /* type specific mbuf allocations */
	};

	Change m_mtypes from u_short to u_long. COMPAT_80 would be required.
	If m_mtypes was just one entry, it would be OK to add new m_mtypes
	next to the current one and make old entry reserved. It would be not
	good to keep 512 bytes spaces.

	/*
	 * Mbuf sysctl variables.
	 */
	#define MBUF_MSIZE              1       /* int: mbuf base size */
	#define MBUF_MCLBYTES           2       /* int: mbuf cluster size */
	#define MBUF_NMBCLUSTERS        3       /* int: limit on the # of clusters */
	#define MBUF_MBLOWAT            4       /* int: mbuf low water mark */
	#define MBUF_MCLLOWAT           5       /* int: mbuf cluster low water mark */
	#define MBUF_STATS              6       /* struct: mbstat */
	#define MBUF_MOWNERS            7       /* struct: m_owner[] */
	#define MBUF_MAXID              8       /* number of valid MBUF ids */

	So, it would be good to change MBUF_STATS as MBUF_OSTATS and
	make new MBUF_STATS with number 8.



Home | Main Index | Thread Index | Old Index