From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0119.outbound.protection.outlook.com [207.46.100.119]) by dpdk.org (Postfix) with ESMTP id 1E02E5A8C for ; Mon, 30 Mar 2015 19:39:10 +0200 (CEST) Received: from CY1PR0101MB0987.prod.exchangelabs.com (25.160.224.149) by CY1PR0101MB0987.prod.exchangelabs.com (25.160.224.149) with Microsoft SMTP Server (TLS) id 15.1.118.21; Mon, 30 Mar 2015 17:39:07 +0000 Received: from CY1PR0101MB0987.prod.exchangelabs.com ([25.160.224.149]) by CY1PR0101MB0987.prod.exchangelabs.com ([25.160.224.149]) with mapi id 15.01.0118.022; Mon, 30 Mar 2015 17:39:07 +0000 From: Don Provan To: "Richardson, Bruce" , Neil Horman Thread-Topic: [dpdk-dev] [PATCH] mbuf: add comment explaining confusing code Thread-Index: AQHQaLlqLzR1WHnxjUmB2jaSF9Jlep01TKUQ Date: Mon, 30 Mar 2015 17:39:06 +0000 Message-ID: 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: <59AF69C657FD0841A61C55336867B5B0344F112F@IRSMSX103.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [209.234.132.35] authentication-results: intel.com; dkim=none (message not signed) header.d=none; x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0101MB0987; x-forefront-antispam-report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(51704005)(76176999)(106116001)(40100003)(54356999)(50986999)(77156002)(62966003)(66066001)(87936001)(2950100001)(33656002)(74316001)(2656002)(46102003)(19580395003)(86362001)(19580405001)(92566002)(2900100001)(102836002)(93886004); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0101MB0987; H:CY1PR0101MB0987.prod.exchangelabs.com; FPR:; SPF:None; MLV:sfv; LANG:en; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(5002010)(5005006); SRVR:CY1PR0101MB0987; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0101MB0987; x-forefront-prvs: 05315CBE52 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: bivio.net X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2015 17:39:06.3144 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8731bc55-0e76-4eb7-ae4b-401e56037945 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0101MB0987 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: Mon, 30 Mar 2015 17:39:10 -0000 > > > > > > > > if (likely (rte_mbuf_refcnt_read(m) =3D=3D 1) || > > > > > > > > likely (rte_mbuf_refcnt_update(m, -1) =3D=3D 0)) In all the debate about atomics, I don't think anyone got around to pointin= g 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