From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 8FBAA1B937 for ; Fri, 11 Jan 2019 11:58:53 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2019 02:58:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,465,1539673200"; d="scan'208";a="133665412" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.54]) by fmsmga002.fm.intel.com with SMTP; 11 Jan 2019 02:58:49 -0800 Received: by (sSMTP sendmail emulation); Fri, 11 Jan 2019 10:58:48 +0000 Date: Fri, 11 Jan 2019 10:58:48 +0000 From: Bruce Richardson To: "Burakov, Anatoly" Cc: Gage Eads , dev@dpdk.org, olivier.matz@6wind.com, arybchenko@solarflare.com, konstantin.ananyev@intel.com Message-ID: <20190111105848.GA18132@bricha3-MOBL.ger.corp.intel.com> References: <20190110210122.24889-1-gage.eads@intel.com> <20190110210122.24889-2-gage.eads@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH 1/6] ring: change head and tail to pointer-width size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2019 10:58:54 -0000 On Fri, Jan 11, 2019 at 10:40:19AM +0000, Burakov, Anatoly wrote: > <...> > > > + * Copyright(c) 2016-2019 Intel Corporation > > */ > > /** > > @@ -88,7 +88,7 @@ rte_event_ring_enqueue_burst(struct rte_event_ring *r, > > const struct rte_event *events, > > unsigned int n, uint16_t *free_space) > > { > > - uint32_t prod_head, prod_next; > > + uintptr_t prod_head, prod_next; > > I would also question the use of uinptr_t. I think semnatically, size_t is > more appropriate. > Yes, it would, but I believe in this case they want to use the largest size of (unsigned)int where there exists an atomic for manipulating 2 of them simultaneously. [The largest size is to minimize any chance of an ABA issue occuring]. Therefore we need 32-bit values on 32-bit and 64-bit on 64, and I suspect the best way to guarantee this is to use pointer-sized values. If size_t is guaranteed across all OS's to have the same size as uintptr_t it could also be used, though. /Bruce