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

Zoltan Kiss zoltan.kiss at linaro.org
Tue Mar 31 14:33:45 CEST 2015


Hi,

On 30/03/15 18:39, Don Provan wrote:
>>>>>>>>>   	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
>

I was thinking about that too, either remove it or turn it into 
"unlikely". Currently it suggest that "if there are more than one users, 
they are likely to release at the same time". If that's not true, we 
should remove it, but as Don said, it would hardly make a difference in 
real world cases as more than one users is not really a hot usecase, AFAIK.

Regards,

Zoltan


More information about the dev mailing list