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.
This commit is contained in:
parent
39283b0b4b
commit
cd5bb63b3d
@ -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
|
||||
|
@ -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);
|
||||
|
@ -187,6 +187,7 @@ struct mbuf {
|
||||
#define EXT_SFBUF 2 /* sendfile(2)'s sf_bufs */
|
||||
#define EXT_JUMBO9 3 /* jumbo cluster 9216 bytes */
|
||||
#define EXT_JUMBO16 4 /* jumbo cluster 16184 bytes */
|
||||
#define EXT_PACKET 5 /* mbuf+cluster from packet zone */
|
||||
#define EXT_NET_DRV 100 /* custom ext_buf provided by net driver(s) */
|
||||
#define EXT_MOD_TYPE 200 /* custom module's ext_buf type */
|
||||
#define EXT_DISPOSABLE 300 /* can throw this buffer away w/page flipping */
|
||||
|
Loading…
Reference in New Issue
Block a user