MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mb_dtor_pack

Function mb_dtor_pack

freebsd/kern/kern_mbuf.c:673–703  ·  view source on GitHub ↗

* The Mbuf Packet zone destructor. */

Source from the content-addressed store, hash-verified

671 * The Mbuf Packet zone destructor.
672 */
673static void
674mb_dtor_pack(void *mem, int size, void *arg)
675{
676 struct mbuf *m;
677
678 m = (struct mbuf *)mem;
679 if ((m->m_flags & M_PKTHDR) != 0)
680 m_tag_delete_chain(m, NULL);
681
682 /* Make sure we've got a clean cluster back. */
683 KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__));
684 KASSERT(m->m_ext.ext_buf != NULL, ("%s: ext_buf == NULL", __func__));
685 KASSERT(m->m_ext.ext_free == NULL, ("%s: ext_free != NULL", __func__));
686 KASSERT(m->m_ext.ext_arg1 == NULL, ("%s: ext_arg1 != NULL", __func__));
687 KASSERT(m->m_ext.ext_arg2 == NULL, ("%s: ext_arg2 != NULL", __func__));
688 KASSERT(m->m_ext.ext_size == MCLBYTES, ("%s: ext_size != MCLBYTES", __func__));
689 KASSERT(m->m_ext.ext_type == EXT_PACKET, ("%s: ext_type != EXT_PACKET", __func__));
690#ifdef INVARIANTS
691 trash_dtor(m->m_ext.ext_buf, MCLBYTES, arg);
692#endif
693 /*
694 * If there are processes blocked on zone_clust, waiting for pages
695 * to be freed up, cause them to be woken up by draining the
696 * packet zone. We are exposed to a race here (in the check for
697 * the UMA_ZFLAG_FULL) where we might miss the flag set, but that
698 * is deliberate. We don't want to acquire the zone lock for every
699 * mbuf free.
700 */
701 if (uma_zone_exhausted(zone_clust))
702 uma_zone_reclaim(zone_pack, UMA_RECLAIM_DRAIN);
703}
704
705/*
706 * The Cluster and Jumbo[PAGESIZE|9|16] zone constructor.

Callers

nothing calls this directly

Calls 4

m_tag_delete_chainFunction · 0.85
trash_dtorFunction · 0.85
uma_zone_exhaustedFunction · 0.85
uma_zone_reclaimFunction · 0.85

Tested by

no test coverage detected