DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Olivier MATZ <olivier.matz@6wind.com>,
	"Hanoch Haim (hhaim)" <hhaim@cisco.com>
Cc: Ilya Matveychikov <matvejchikov@gmail.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage
Date: Thu, 16 Nov 2017 10:54:34 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB9772585FABD995@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <20171115173058.mrkrv3usbl5sfw3h@platinum>

Hi Olivier,

> I agree with Konstantin's comment done in another thread [1]:
> 
>   '''
>   That would cause extra read; cmp (and possible slowdown) for atomic refcnt.
>   If that really need to be fixed - probably we need to introduce a new function
>   that would do update without trying to read refctn first - rte_mbuf_refcnt_update_blind() or so.
>   '''
> 
> However I'm not sure a new function is really needed: the name is not ideal,

That was just the first one from top of my head  :)
If the issue in naming only - I suppose we can find something better.
Personally I like Ilya's one: __rte_mbuf_refcnt_update().

> and it would only be used once. What about the patch below?

It would do the job too, but looks a bit clumsy to me.
Konstantin

> 
> ==============================
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -1361,8 +1361,18 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
> 
>                 return m;
> 
> -       } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) {
> +       } else {
> 
> +               /* We don't use rte_mbuf_refcnt_update() because we already
> +                * tested that refcnt != 1.
> +                */
> +#ifdef RTE_MBUF_REFCNT_ATOMIC
> +               ret = rte_atomic16_add_return(&m->refcnt_atomic, -1);
> +#else
> +               ret = --m->refcnt;
> +#endif
> +               if (ret != 0)
> +                       return NULL;
> 
>                 if (RTE_MBUF_INDIRECT(m))
>                         rte_pktmbuf_detach(m);
> @@ -1375,7 +1385,6 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
> 
>                 return m;
>         }
> -       return NULL;
>  }
> 
>  /* deprecated, replaced by rte_pktmbuf_prefree_seg() */
> ==============================
> 
> [1] http://dpdk.org/dev/patchwork/patch/31378/
> 
> 
> Regards,
> Olivier

  parent reply	other threads:[~2017-11-16 10:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15  9:14 Hanoh Haim
2017-11-15 11:13 ` Ilya Matveychikov
2017-11-15 12:46   ` Hanoch Haim (hhaim)
2017-11-15 17:30     ` Olivier MATZ
2017-11-16  7:16       ` Hanoch Haim (hhaim)
2017-11-16  8:07         ` Ilya Matveychikov
2017-11-16  8:42         ` Olivier MATZ
2017-11-16  9:06           ` Hanoch Haim (hhaim)
2017-11-16  9:32             ` Ilya Matveychikov
2017-11-16  9:37               ` Olivier MATZ
2017-11-16  9:44                 ` Ilya Matveychikov
2017-11-16 10:54       ` Ananyev, Konstantin [this message]
2017-12-08 15:46 ` [dpdk-dev] [PATCH v4] mbuf: fix mbuf free performance with non atomic refcnt Olivier Matz
2017-12-08 16:04   ` Ilya Matveychikov
2017-12-08 16:19     ` Olivier MATZ
2017-12-08 16:37   ` Stephen Hemminger
2017-12-10  8:37   ` Hanoch Haim (hhaim)
2017-12-11 10:28   ` Olivier MATZ
2018-01-18 23:23   ` Thomas Monjalon

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=2601191342CEEE43887BDE71AB9772585FABD995@irsmsx105.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    --cc=hhaim@cisco.com \
    --cc=matvejchikov@gmail.com \
    --cc=olivier.matz@6wind.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).