[dpdk-dev] [PATCH] mbuf: add comment explaining confusing code

Don Provan dprovan at bivio.net
Mon Mar 30 19:39:06 CEST 2015


> > > > > > > >  	if (likely (rte_mbuf_refcnt_read(m) == 1) ||
> > > > > > > >  			likely (rte_mbuf_refcnt_update(m, -1) == 0))

In all the debate about atomics, I don't think anyone got around to pointing out that in the unlikely case that the refcnt is not 1, then it's equally unlikely that decrementing it will result in 0 despite the code's claim to the contrary. That's the part that confused me. Would it make sense to fix this while adding the comment?
-don
dprovan at bivio.net



More information about the dev mailing list