Does anyone here understand this bit of code in mb_free_ext()?

        /* Free attached storage if this mbuf is the only reference to it. */
        if (*(m->m_ext.ref_cnt) == 1 ||
            atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) {
                switch (m->m_ext.ext_type) {
                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. */

Why would *(m->m_ext.ref_cnt) == 0 be true when the if condition
checks only for ref_cnt to be 1? Should the atomic_fetchadd_int() be
checked for <= 1?

Also, why is the packet zone special? Any history here?

-vijay
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to