diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-07-17 14:04:03 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-07-17 14:04:03 +0000 |
commit | 38dffb25ed020bf3bd3136f835904c8618803952 (patch) | |
tree | 9aa25437d2359619ec3fd7047a6c85ef26da0e20 | |
parent | 82bb8e24de2d0f1c63aa8925bf17958bdbdf2153 (diff) | |
download | FreeBSD-src-38dffb25ed020bf3bd3136f835904c8618803952.zip FreeBSD-src-38dffb25ed020bf3bd3136f835904c8618803952.tar.gz |
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
-rw-r--r-- | sys/kern/kern_mbuf.c | 10 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf2.c | 3 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 10 |
3 files changed, 18 insertions, 5 deletions
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index b6b75c1..1ea6274 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -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 */ diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index 81b2260..109b3a6 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -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); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index c514e0f..9fb385c 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -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. |