Date: Thu, 16 Aug 2012 20:33:12 -0700 From: Vijay Singh <vijju.singh@gmail.com> To: net@freebsd.org Subject: a query in mb_free_ext() Message-ID: <CALCNsJSXt%2BYxCfg629nQk7a4f3JaaK=xdqXG8MqNXR3JrhC8Dw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALCNsJSXt%2BYxCfg629nQk7a4f3JaaK=xdqXG8MqNXR3JrhC8Dw>