From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id 3EA1D6849 for ; Tue, 31 Mar 2015 14:33:47 +0200 (CEST) Received: by wibgn9 with SMTP id gn9so24087141wib.1 for ; Tue, 31 Mar 2015 05:33:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=6VfSOmNkgFrPKk0XnopUC7TA2oTPLlerzeyLllnj4HI=; b=G25nnm//hJ6oZLQPEAsQCq1CFE/o42NyH+ZoAS+o60CszAGwqyteFAMR5xVvc/V45f 5o/x3+77CijO2GDOn8XURzUPFWd/X/E/1k+dmDzp8cQE0CuKxzNqZqrDNEZmCn6AkoCo nKc26ZYkK++bHnAtToAlC/9kd4C/cOoUFbSeA6YK1+2a+vpKx+20X3HhPS4CH8c4yqqh 1CdgJNnbIrS0Uq+vB5nXXjChtGCdYoZhubJYWX0uD3nfaQaaUjB9UxnUNMH8iLjd3eBC riSsPdCFa2sCcjB8p4U4eTvf7sgrOXg/L8gwtyb/krtZwuv/o5owobc3Z4MhoQlSzTsM tAIQ== X-Gm-Message-State: ALoCoQnlEyZ/lcbieOHrgx2e6WOsEvtuYPJ6YJKRzEZqm5RH9iykn3pP94Glxl91ZiYXiQburM60 X-Received: by 10.180.90.106 with SMTP id bv10mr5101444wib.4.1427805227081; Tue, 31 Mar 2015 05:33:47 -0700 (PDT) Received: from [192.168.0.101] ([90.152.119.35]) by mx.google.com with ESMTPSA id ha10sm20169702wjc.37.2015.03.31.05.33.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 05:33:46 -0700 (PDT) Message-ID: <551A9429.8030502@linaro.org> Date: Tue, 31 Mar 2015 13:33:45 +0100 From: Zoltan Kiss User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Don Provan , "Richardson, Bruce" , Neil Horman References: <1427404494-27256-1-git-send-email-bruce.richardson@intel.com> <20150327102956.GB5375@hmsreliant.think-freely.org> <20150327113238.GA11660@bricha3-MOBL3> <20150327140735.GG5375@hmsreliant.think-freely.org> <20150327143049.GB9972@bricha3-MOBL3> <20150327143841.GH5375@hmsreliant.think-freely.org> <20150327145526.GA10332@bricha3-MOBL3> <20150327164358.GI5375@hmsreliant.think-freely.org> <59AF69C657FD0841A61C55336867B5B0344F112F@IRSMSX103.ger.corp.intel.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] mbuf: add comment explaining confusing code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2015 12:33:47 -0000 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