Define four constants, MBUF_{,MEM,CLUSTER,PACKET,TAG}_MEM_NAME, which
are string names for their respective UMA zones and malloc types, and are passed into uma_zcreate() and MALLOC_DEFINE(). Export them outside of _KERNEL in mbuf.h so that netstat can reference them. Change the names to improve consistency, with each zone/type associated with the mbuf allocator being prefixed mbuf_. MFC after: 1 week
This commit is contained in:
parent
82bb8e24de
commit
38dffb25ed
@ -135,13 +135,15 @@ mbuf_init(void *dummy)
|
||||
/*
|
||||
* Configure UMA zones for Mbufs, Clusters, and Packets.
|
||||
*/
|
||||
zone_mbuf = uma_zcreate("Mbuf", MSIZE, mb_ctor_mbuf, mb_dtor_mbuf,
|
||||
zone_mbuf = uma_zcreate(MBUF_MEM_NAME, MSIZE, mb_ctor_mbuf,
|
||||
mb_dtor_mbuf,
|
||||
#ifdef INVARIANTS
|
||||
trash_init, trash_fini, MSIZE - 1, UMA_ZONE_MAXBUCKET);
|
||||
#else
|
||||
NULL, NULL, MSIZE - 1, UMA_ZONE_MAXBUCKET);
|
||||
#endif
|
||||
zone_clust = uma_zcreate("MbufClust", MCLBYTES, mb_ctor_clust,
|
||||
zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES,
|
||||
mb_ctor_clust,
|
||||
#ifdef INVARIANTS
|
||||
mb_dtor_clust, trash_init, trash_fini, UMA_ALIGN_PTR, UMA_ZONE_REFCNT);
|
||||
#else
|
||||
@ -149,8 +151,8 @@ mbuf_init(void *dummy)
|
||||
#endif
|
||||
if (nmbclusters > 0)
|
||||
uma_zone_set_max(zone_clust, nmbclusters);
|
||||
zone_pack = uma_zsecond_create("Packet", mb_ctor_pack, mb_dtor_pack,
|
||||
mb_init_pack, mb_fini_pack, zone_mbuf);
|
||||
zone_pack = uma_zsecond_create(MBUF_PACKET_MEM_NAME, mb_ctor_pack,
|
||||
mb_dtor_pack, mb_init_pack, mb_fini_pack, zone_mbuf);
|
||||
|
||||
/* uma_prealloc() goes here */
|
||||
|
||||
|
@ -76,7 +76,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/mutex.h>
|
||||
|
||||
static MALLOC_DEFINE(M_PACKET_TAGS, "mbuf tags", "packet-attached information");
|
||||
static MALLOC_DEFINE(M_PACKET_TAGS, MBUF_TAG_MEM_NAME,
|
||||
"packet-attached information");
|
||||
|
||||
/* can't call it m_dup(), as freebsd[34] uses m_dup() with different arg */
|
||||
static struct mbuf *m_dup1(struct mbuf *, int, int, int);
|
||||
|
@ -287,6 +287,16 @@ struct mbstat {
|
||||
#define M_TRYWAIT M_WAITOK
|
||||
#define M_WAIT M_WAITOK
|
||||
|
||||
/*
|
||||
* String names of mbuf-related UMA(9) and malloc(9) types. Exposed to
|
||||
* !_KERNEL so that monitoring tools can look up the zones with
|
||||
* libmemstat(3).
|
||||
*/
|
||||
#define MBUF_MEM_NAME "mbuf"
|
||||
#define MBUF_CLUSTER_MEM_NAME "mbuf_cluster"
|
||||
#define MBUF_PACKET_MEM_NAME "mbuf_packet"
|
||||
#define MBUF_TAG_MEM_NAME "mbuf_tag"
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*-
|
||||
* mbuf external reference count management macros.
|
||||
|
Loading…
Reference in New Issue
Block a user