From: Zoltan Kiss <zoltan.kiss@linaro.org>
To: Don Provan <dprovan@bivio.net>,
"Richardson, Bruce" <bruce.richardson@intel.com>,
Neil Horman <nhorman@tuxdriver.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] mbuf: add comment explaining confusing code
Date: Tue, 31 Mar 2015 13:33:45 +0100 [thread overview]
Message-ID: <551A9429.8030502@linaro.org> (raw)
In-Reply-To: <CY1PR0101MB098798EEE9925C308B388CCDA0F50@CY1PR0101MB0987.prod.exchangelabs.com>
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@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
next prev parent reply other threads:[~2015-03-31 12:33 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 21:14 Bruce Richardson
2015-03-26 21:31 ` Olivier MATZ
2015-03-27 10:29 ` Neil Horman
2015-03-27 10:49 ` Ananyev, Konstantin
2015-03-27 11:32 ` Bruce Richardson
2015-03-27 12:42 ` Neil Horman
2015-03-27 14:07 ` Neil Horman
2015-03-27 14:30 ` Bruce Richardson
2015-03-27 14:38 ` Neil Horman
2015-03-27 14:55 ` Bruce Richardson
2015-03-27 16:43 ` Neil Horman
2015-03-27 16:56 ` Richardson, Bruce
2015-03-30 17:11 ` Thomas Monjalon
2015-03-30 17:39 ` Don Provan
2015-03-30 18:15 ` Stephen Hemminger
2015-03-31 12:33 ` Zoltan Kiss [this message]
2015-03-30 19:39 ` Marc Sune
2015-03-30 20:26 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=551A9429.8030502@linaro.org \
--to=zoltan.kiss@linaro.org \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=dprovan@bivio.net \
--cc=nhorman@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).