From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id F12A3199B6 for ; Fri, 8 Dec 2017 17:04:53 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id f9so3976332wmh.0 for ; Fri, 08 Dec 2017 08:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=K0CONR+NHXAMRlYLsBfp1GlVwmdYSTV3XDps7EV29Fc=; b=TbIYAbgjxg3UylrbuEsWjRE7TSCFnI0BnFL8R31wnbHVHZtPHYipn6RYqL+j4SHw+e IN7rwKfFc383nz4Upq5cQGwymx57YjpxM49SEJ5JjINfQIhAfO94nUtDyqY2E4sn1O7e Zot6nvQNV00r7l0JjAzg767jFAK+Mt0Fgj3fyOeo/UJ2+sMyoKlOc9A0Er4xDU0TJtbU /oFX6md3KqXoBpUwc7D3rkiteUdo63SImROzfXKMzlxaUvuKhcxJtrWvuScWXSoDuQrp RdZy6Od2M3BT6CUubS+2666KWZLTQjmoJRuy8PPqiYBcnVbGLCeYx2bdjnS5YmJIj/Dm ZzIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=K0CONR+NHXAMRlYLsBfp1GlVwmdYSTV3XDps7EV29Fc=; b=k5upthq8w9cmMUf5QtqcdvOwS9WfNwv0cfsBfFBXUzt84QTBszktAXFDHL/XVegELr irUbCvwfuBKjf4Z4VNqRV9vp7mCKSqbSIS/HF92ATJgFmB2+3h+c5gpqb/sJE1Vawvgn verOerzUKwNW8mT6KUzpvD587ZAG0urUp+s7vBkgQ9zt6NkOAQ0+WOQRy2hm1/ON/rEq 3yJT+jIUieNxV06iSyELMAv03nBnd4898y7usH0aJbtiTxiXPzjxHFTRYbSI191IWl/+ kGCTy1tR7MsVPJkBs2IFNqxXkj4zfkZ30SMWrLPRWZ9Eqp3zHrKk5y4g9VaWQuN7HL8D 5PqQ== X-Gm-Message-State: AJaThX56MBVhB4lhDvWjfsh4D8BTnADnAmxPWuwR1JTydxAC/4LTvTjT gzDvdriE+PElJf/P8USe6nA= X-Google-Smtp-Source: AGs4zMY9Hbv3PMNeRl2RcsvHKP5wyiDE3KJ6Ftka4hellFCEKJPS/Tp4XS5ytbcbLRzbCmx2LP0duQ== X-Received: by 10.80.157.134 with SMTP id w6mr52583495ede.151.1512749093666; Fri, 08 Dec 2017 08:04:53 -0800 (PST) Received: from [192.168.1.115] ([94.205.75.192]) by smtp.gmail.com with ESMTPSA id l50sm3459490eda.85.2017.12.08.08.04.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Dec 2017 08:04:53 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) From: Ilya Matveychikov In-Reply-To: <20171208154651.16546-1-olivier.matz@6wind.com> Date: Fri, 8 Dec 2017 20:04:50 +0400 Cc: dev@dpdk.org, "Hanoch Haim (hhaim)" , konstantin.ananyev@intel.com Content-Transfer-Encoding: quoted-printable Message-Id: <60A7E7E9-91D7-48C0-BE51-D284318FD659@gmail.com> References: <20171115091413.27119-1-hhaim@cisco.com> <20171208154651.16546-1-olivier.matz@6wind.com> To: Olivier Matz X-Mailer: Apple Mail (2.3445.4.7) 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:04:54 -0000 Olivier, > On Dec 8, 2017, at 7:46 PM, Olivier Matz = wrote: >=20 >=20 > lib/librte_mbuf/rte_mbuf.h | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) >=20 > 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); > } >=20 > +/* 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=E2=80=99s the purpose of using direct cast to uint16_t here and in = other places? > +} > + > /** > * Adds given value to an mbuf's refcnt and returns its new value. > * @param m > @@ -788,19 +795,26 @@ rte_mbuf_refcnt_update(struct rte_mbuf *m, = int16_t value) > return 1 + value; > } >=20 > - return (uint16_t)(rte_atomic16_add_return(&m->refcnt_atomic, = value)); > + return __rte_mbuf_refcnt_update(m, value); > } >=20 > #else /* ! RTE_MBUF_REFCNT_ATOMIC */ >=20 > +/* internal */ > +static inline uint16_t > +__rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) > +{ > + m->refcnt =3D (uint16_t)(m->refcnt + value); > + return m->refcnt; > +} > + > /** > * Adds given value to an mbuf's refcnt and returns its new value. > */ > static inline uint16_t > rte_mbuf_refcnt_update(struct rte_mbuf *m, int16_t value) > { > - m->refcnt =3D (uint16_t)(m->refcnt + value); > - return m->refcnt; > + return __rte_mbuf_refcnt_update(m, value); > } >=20 > /** > @@ -1364,8 +1378,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) >=20 > return m; >=20 > - } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) =3D=3D= 0) { > - > + } else if (__rte_mbuf_refcnt_update(m, -1) =3D=3D 0) { >=20 > if (RTE_MBUF_INDIRECT(m)) > rte_pktmbuf_detach(m); > --=20 > 2.11.0 >=20