From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 17BACA2EEB for ; Wed, 11 Sep 2019 13:40:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6F5E51E947; Wed, 11 Sep 2019 13:40:05 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 1574E1E943 for ; Wed, 11 Sep 2019 13:40:03 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id a11so14380298wrx.1 for ; Wed, 11 Sep 2019 04:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7r3hIuwc+gWmEnfh4qjRYXah1+vdLKKYVyep6kbY9sc=; b=Rli2ZTuyQUh7oTSIPvGC0PnVjFg3rrPfFDLlRLz+jzmZZZmjx92CLsvw+hDpB0bOz2 ClBxXjzzWsxOdUbNMbvzOeigYIohrrij4xpCKwY841IEa/KeqXB984nSWZ1Y7mLv1ELo z4XBxv/4BN3PsQsCS4SObl8nrkVaNVD7C8k458vmDbJwns0hWu+WsGDLW7XW1mShZs+o xgiW8LIr3rA0RejHUK4i6OSxQubE4BTr7MBFNgkgTsG1TEDYwnyORZz9aRhL08+3Wm2K 76ingdgTFUA/8+t+krdsislnifVfe6aOFBaTjwj5COza8XZ01hyWVmCkmIMow0ghdtL/ Eq5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7r3hIuwc+gWmEnfh4qjRYXah1+vdLKKYVyep6kbY9sc=; b=Dui8WWo3ahRDYc4Oty3jBEr7OHSnWg2jM1VIQJ8gKyoNXx1QF1Wg2YGdfpfOwmqxbZ Kl7+zY9equqwuoocvaE86lh3LufR7SabIGcWqIVtwuc1OtIR5sXbZgdE87LhlOelqaIZ J90m4jLIucww+TPDu8v/Bax38OmeVfS+5SIdxz9aMY+3JF2BcraiOB3Tl/Cpr/nwAvkO RQ3JAcATeMCuXHk6suO625qUFLiF2wi+8aTFu7lBI+o6krhpb6V24P9RXmu2tAW5agXD u5Qqsfv0V2tXmwtN5bWln14RAW88rMl8CEZgbVWiu2Jz/D6fSYdQqvnGw1BFmbbtdDzu QWVA== X-Gm-Message-State: APjAAAVsA8oGNQlENDqqzPBJAZl1p6KgSbXLITg6BF/38vkoJX6AGWRB Uyumx2xYFWwV06V8yEvxMY+yxurHMnHM6w== X-Google-Smtp-Source: APXvYqwg5rpSmHczTjSQiPltYpb0c/cnmiQoW6H4jVgFNnWu7K7UjXqPdRRrx8RIDbBhySzpEnSBvA== X-Received: by 2002:adf:aa85:: with SMTP id h5mr3317498wrc.329.1568202003664; Wed, 11 Sep 2019 04:40:03 -0700 (PDT) Received: from xps13 (110.8.30.213.rev.vodafone.pt. [213.30.8.110]) by smtp.gmail.com with ESMTPSA id d18sm25751257wra.91.2019.09.11.04.40.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2019 04:40:03 -0700 (PDT) Date: Wed, 11 Sep 2019 12:39:59 +0100 From: Stephen Hemminger To: Olivier Matz Cc: Morten =?UTF-8?B?QnLDuHJ1cA==?= , dev@dpdk.org Message-ID: <20190911123959.1ec347a3@xps13> In-Reply-To: <20190911113313.5nrcjvtm5dgi2r76@platinum> References: <20190911091908.123151-1-mb@smartsharesystems.com> <20190911121834.4ec73590@xps13> <20190911113313.5nrcjvtm5dgi2r76@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH] mbuf: add bulk free function 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 11 Sep 2019 13:33:13 +0200 Olivier Matz wrote: > Hi, >=20 > On Wed, Sep 11, 2019 at 12:18:34PM +0100, Stephen Hemminger wrote: > > On Wed, 11 Sep 2019 09:19:08 +0000 > > Morten Br=C3=B8rup wrote: > > =20 > > > Add function for freeing a bulk of mbufs. > > >=20 > > > Signed-off-by: Morten Br=C3=B8rup > > > --- > > > lib/librte_mbuf/rte_mbuf.h | 17 +++++++++++++++++ > > > 1 file changed, 17 insertions(+) > > >=20 > > > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h > > > index 98225ec80..f2e174da1 100644 > > > --- a/lib/librte_mbuf/rte_mbuf.h > > > +++ b/lib/librte_mbuf/rte_mbuf.h > > > @@ -1907,6 +1907,23 @@ static inline void rte_pktmbuf_free(struct rte= _mbuf *m) > > > } > > > } > > > =20 > > > +/** > > > + * Free a bulk of mbufs back into their original mempool. > > > + * > > > + * @param mbufs > > > + * Array of pointers to mbufs > > > + * @param count > > > + * Array size > > > + */ > > > +static inline void > > > +rte_pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned count) > > > +{ > > > + unsigned idx =3D 0; > > > + > > > + for (idx =3D 0; idx < count; idx++) > > > + rte_pktmbuf_free(mbufs[idx]); > > > +} > > > + =20 > >=20 > > You can optimize this to use mempool bulk put operation. =20 >=20 > A bulk free for mbuf is not as simple as a bulk mempool put, because > of indirect mbufs, and because mbufs may return in different mempools. >=20 > Morten, do you have more details about why do you need such a function? >=20 > Thanks, > Olivier I was thinking of a function that looked at the list and if they were all the same pool and safe to bulk put, then use that as a fast path. This would be the most common case. Also, less inline functions please. When it is an inline it adds more API/A= BI dependencies.