summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2005-11-05 19:43:55 +0000
committerandre <andre@FreeBSD.org>2005-11-05 19:43:55 +0000
commit07bbeaa7561d8f472f27f07c34bdb81d141cd448 (patch)
treee16b6429310ae66ea56b3c0ac095805aea0d4c1c /sys/kern
parentc5417f9f3340f25c97b883a189476208962e9b7a (diff)
downloadFreeBSD-src-07bbeaa7561d8f472f27f07c34bdb81d141cd448.zip
FreeBSD-src-07bbeaa7561d8f472f27f07c34bdb81d141cd448.tar.gz
Free only those mbuf+clusters back to the packet zone that were allocated
from there. All others get broken up and free'd individually to the mbuf and cluster zones. The packet zone is a secondary zone to the mbuf zone. There is currently a limitation in UMA which prevents decreasing the packet zone stock when the mbuf and cluster zone are drained and all their members are part of packets. When this is fixed this change may be reverted.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_mbuf.c3
-rw-r--r--sys/kern/uipc_mbuf.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index ffb3e80..d61fab3 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -332,7 +332,7 @@ mb_dtor_pack(void *mem, int size, void *arg)
KASSERT(m->m_ext.ext_free == NULL, ("%s: ext_free != NULL", __func__));
KASSERT(m->m_ext.ext_args == NULL, ("%s: ext_args != NULL", __func__));
KASSERT(m->m_ext.ext_size == MCLBYTES, ("%s: ext_size != MCLBYTES", __func__));
- KASSERT(m->m_ext.ext_type == EXT_CLUSTER, ("%s: ext_type != EXT_CLUSTER", __func__));
+ KASSERT(m->m_ext.ext_type == EXT_PACKET, ("%s: ext_type != EXT_CLUSTER", __func__));
KASSERT(*m->m_ext.ref_cnt == 1, ("%s: ref_cnt != 1", __func__));
#ifdef INVARIANTS
trash_dtor(m->m_ext.ext_buf, MCLBYTES, arg);
@@ -417,6 +417,7 @@ mb_zinit_pack(void *mem, int size, int how)
uma_zalloc_arg(zone_clust, m, how);
if (m->m_ext.ext_buf == NULL)
return (ENOMEM);
+ m->m_ext.ext_type = EXT_PACKET; /* Override. */
#ifdef INVARIANTS
trash_init(m->m_ext.ext_buf, MCLBYTES, how);
#endif
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 4e0f2d9..e4b5483 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -217,11 +217,13 @@ mb_free_ext(struct mbuf *m)
if (*(m->m_ext.ref_cnt) == 1 ||
atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) {
switch (m->m_ext.ext_type) {
- case EXT_CLUSTER: /* The packet zone is special. */
+ case EXT_PACKET: /* The packet zone is special. */
if (*(m->m_ext.ref_cnt) == 0)
*(m->m_ext.ref_cnt) = 1;
uma_zfree(zone_pack, m);
return; /* Job done. */
+ case EXT_CLUSTER:
+ uma_zfree(zone_clust, m->m_ext.ext_buf);
break;
case EXT_JUMBO9:
uma_zfree(zone_jumbo9, m->m_ext.ext_buf);
OpenPOWER on IntegriCloud