From: Stephen Hemminger <stephen@networkplumber.org>
To: huangdengdui <huangdengdui@huawei.com>
Cc: Jie Hai <haijie1@huawei.com>, <dev@dpdk.org>,
<thomas@monjalon.net>, <ferruh.yigit@amd.com>,
<david.marchand@redhat.com>, <andrew.rybchenko@oktetlabs.ru>,
Chengwen Feng <fengchengwen@huawei.com>,
"Wei Hu (Xavier)" <xavier.huwei@huawei.com>,
Huisong Li <lihuisong@huawei.com>
Subject: Re: [PATCH 1/3] net/hns3: fix simple Tx path incorrect free the mbuf
Date: Thu, 9 Jan 2025 09:03:19 -0800 [thread overview]
Message-ID: <20250109090319.261ac377@pi5> (raw)
In-Reply-To: <51df8d40-c158-4b67-98b0-ca4517f4bd2c@huawei.com>
On Thu, 9 Jan 2025 15:43:12 +0800
huangdengdui <huangdengdui@huawei.com> wrote:
> On 2025/1/9 0:57, Stephen Hemminger wrote:
> > On Wed, 8 Jan 2025 10:40:43 +0800
> > Jie Hai <haijie1@huawei.com> wrote:
> >
> >> On 2024/12/31 1:55, Stephen Hemminger wrote:
> >>> On Mon, 30 Dec 2024 14:54:03 +0800
> >>> Jie Hai <haijie1@huawei.com> wrote:
> >>>
> >>>> From: Jie Hai <haijie1@huawei.com>
> >>>> To: <dev@dpdk.org>, <thomas@monjalon.net>, <ferruh.yigit@amd.com>, <david.marchand@redhat.com>, <andrew.rybchenko@oktetlabs.ru>, Chengwen Feng <fengchengwen@huawei.com>, "Wei Hu (Xavier)" <xavier.huwei@huawei.com>, Huisong Li <lihuisong@huawei.com>
> >>>> CC: <haijie1@huawei.com>, <huangdengdui@huawei.com>
> >>>> Subject: [PATCH 1/3] net/hns3: fix simple Tx path incorrect free the mbuf
> >>>> Date: Mon, 30 Dec 2024 14:54:03 +0800
> >>>> X-Mailer: git-send-email 2.22.0
> >>>>
> >>>> From: Dengdui Huang <huangdengdui@huawei.com>
> >>>>
> >>>> When RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload is not set,
> >>>> use rte_pktmbuf_free_seg() to free the mbuf.
> >>>>
> >>>> Fixes: 7ef933908f04 ("net/hns3: add simple Tx path")
> >>>> Cc: stable@dpdk.org
> >>>>
> >>>> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> >>>> Signed-off-by: Jie Hai <haijie1@huawei.com>
> >>>
> >>> What about the fast free case which is using rte_mempool_put_bulk when
> >>> it should use rte_pktmbuf_free_bulk instead?
> >>>
> >>>
> >> Hi, Stephen Hemminger,
> >>
> >> During the fast free case, the performance of using
> >> rte_mempool_put_bulk is higher than that of using
> >> rte_pktmbuf_free_bulk because other references
> >> to mbuf do not need to be considered. So it's better
> >> to not change.
> >>
> >> Thanks,
> >> Jie Hai
> >
> > The problem is that having an open coded version of this buried in
> > one driver is a long term potential proble>
> > If you really think that optimizing free like this is noticeable, then
> > why not make a new function "rte_pktmuf_fast_free_bulk" and put it in the
> > regular mbuf library.
> >
>
> Do you mean to add the following functions to the library?
>
> void rte_pktmbuf_fast_free_bulk(struct rte_mbuf **mbufs, unsigned int count)
> {
> rte_mempool_put_bulk(mbufs[0]->pool, (void **)mbufs, count);
> }
Yes something like that. Or call it rte_mbuf_raw_free_bulk to align with
what rte_mbuf_raw_free(). And maybe add some debug assertions to make sure
that mbuf is not cloned, indirect or has refcnt.
The concern is that this optimization might put an mbuf in the pool
that has different properties than the normal free path.
And that all semantics of allocation/free should be in rte_mbuf code to
allow for future optimizations.
>
> The driver uses rte_mempool_put_bulk only when the following conditions are met:
> 1. All mbufs comes from the same mempool
> 2. All mbufs have only one reference.
> 3. All mbufs have only one segment.
> So the rte_pktmbuf_fast_free_bulk function is just a wrapper around the rte_mempool_put_bulk function.
next prev parent reply other threads:[~2025-01-09 17:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 6:54 [PATCH 0/3] net/hns3: bugfix on hns3 Jie Hai
2024-12-30 6:54 ` [PATCH 1/3] net/hns3: fix simple Tx path incorrect free the mbuf Jie Hai
2024-12-30 17:55 ` Stephen Hemminger
2025-01-08 2:40 ` Jie Hai
2025-01-08 16:57 ` Stephen Hemminger
2025-01-09 7:43 ` huangdengdui
2025-01-09 17:03 ` Stephen Hemminger [this message]
2024-12-30 6:54 ` [PATCH 2/3] net/hns3: remove pvid info dump for VF Jie Hai
2024-12-30 6:54 ` [PATCH 3/3] net/hns3: rename RAS module Jie Hai
2024-12-30 17:51 ` [PATCH 0/3] net/hns3: bugfix on hns3 Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250109090319.261ac377@pi5 \
--to=stephen@networkplumber.org \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=haijie1@huawei.com \
--cc=huangdengdui@huawei.com \
--cc=lihuisong@huawei.com \
--cc=thomas@monjalon.net \
--cc=xavier.huwei@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).