From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id 8C22A1AEEE for ; Fri, 8 Dec 2017 17:19:52 +0100 (CET) Received: from lfbn-1-6068-189.w90-110.abo.wanadoo.fr ([90.110.3.189] helo=droids-corp.org) by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eNLTR-0006Tf-IL; Fri, 08 Dec 2017 17:26:06 +0100 Received: by droids-corp.org (sSMTP sendmail emulation); Fri, 08 Dec 2017 17:19:42 +0100 Date: Fri, 8 Dec 2017 17:19:42 +0100 From: Olivier MATZ To: Ilya Matveychikov Cc: dev@dpdk.org, "Hanoch Haim (hhaim)" , konstantin.ananyev@intel.com Message-ID: <20171208161941.7bjpif7n5kioax4n@platinum> References: <20171115091413.27119-1-hhaim@cisco.com> <20171208154651.16546-1-olivier.matz@6wind.com> <60A7E7E9-91D7-48C0-BE51-D284318FD659@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <60A7E7E9-91D7-48C0-BE51-D284318FD659@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v4] mbuf: fix mbuf free performance with non atomic refcnt 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, 08 Dec 2017 16:19:52 -0000 On Fri, Dec 08, 2017 at 08:04:50PM +0400, Ilya Matveychikov wrote: > Olivier, > > > On Dec 8, 2017, at 7:46 PM, Olivier Matz wrote: > > > > > > > lib/librte_mbuf/rte_mbuf.h | 23 ++++++++++++++++++----- > > 1 file changed, 18 insertions(+), 5 deletions(-) > > > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > index ce8a05ddf..dd08cb72b 100644 > > --- a/lib/librte_mbuf/rte_mbuf.h > > +++ b/lib/librte_mbuf/rte_mbuf.h > > @@ -764,6 +764,13 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) > > rte_atomic16_set(&m->refcnt_atomic, new_value); > > } > > > > +/* internal */ > > +static inline uint16_t > > +__rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) > > +{ > > + return (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, value)); > > What’s the purpose of using direct cast to uint16_t here and in other places? This is just a code move. Few years ago, I remember that icc was quite quick to trigger warnings when doing implicit casts. I don't know it it's still true, but that may be the reason why this was done like this initially, or not. I agree we could remove this explicit cast, but I think it should go in another patch, because there are several of them. Olivier