DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
	<olivier.matz@6wind.com>, <dev@dpdk.org>
Cc: <honnappa.nagarahalli@arm.com>, <bruce.richardson@intel.com>,
	<konstantin.ananyev@huawei.com>
Subject: RE: [PATCH v3] mempool: micro-optimize put function
Date: Tue, 27 Dec 2022 16:37:06 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87601@smartserver.smartshare.dk> (raw)
In-Reply-To: <d4ecb116-edcd-1656-d541-707da08910d8@oktetlabs.ru>

> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> Sent: Tuesday, 27 December 2022 09.54
> 
> On 12/24/22 13:46, Morten Brørup wrote:
> > Micro-optimization:
> > Reduced the most likely code path in the generic put function by
> moving an
> > unlikely check out of the most likely code path and further down.
> >
> > Also updated the comments in the function.
> >
> > v3 (feedback from Konstantin Ananyev):
> > * Removed assertion and comment about the invariant preventing
> overflow
> >    in the comparison. They were more confusing than enlightening.
> > v2 (feedback from Andrew Rybchenko):
> > * Modified comparison to prevent overflow if n is really huge and len
> is
> >    non-zero.
> > * Added assertion about the invariant preventing overflow in the
> >    comparison.
> > * Crossing the threshold is not extremely unlikely, so removed
> likely()
> >    from that comparison.
> >    The compiler will generate code with optimal static branch
> prediction
> >    here anyway.
> >
> > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 
> Thanks for optimizing it further.
> 
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> 
> > ---
> >   lib/mempool/rte_mempool.h | 35 ++++++++++++++++++-----------------
> >   1 file changed, 18 insertions(+), 17 deletions(-)
> >
> > diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
> > index 9f530db24b..61ca0c6b65 100644
> > --- a/lib/mempool/rte_mempool.h
> > +++ b/lib/mempool/rte_mempool.h
> > @@ -1364,32 +1364,33 @@ rte_mempool_do_generic_put(struct rte_mempool
> *mp, void * const *obj_table,
> >   {
> >   	void **cache_objs;
> >
> > -	/* No cache provided */
> > +	/* No cache provided? */
> 
> IMHO such changes do not add value and just add noise.
> There are few similar cases below.
> No strong opinion in any case.
> 

This patch is obsolete, because the zero-copy patch v5 [1] uses the zero-copy put function, which is optimized similarly, in rte_mempool_do_generic_put().

[1]: https://patchwork.dpdk.org/project/dpdk/patch/20221227151700.80887-1-mb@smartsharesystems.com/


      reply	other threads:[~2022-12-27 15:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 10:18 [PATCH] " Morten Brørup
2022-11-16 11:04 ` Andrew Rybchenko
2022-11-16 11:10   ` Morten Brørup
2022-11-16 11:29     ` Andrew Rybchenko
2022-11-16 12:14 ` [PATCH v2] " Morten Brørup
2022-11-16 15:51   ` Honnappa Nagarahalli
2022-11-16 15:59     ` Morten Brørup
2022-11-16 16:26       ` Honnappa Nagarahalli
2022-11-16 17:39         ` Morten Brørup
2022-12-19  8:50           ` Morten Brørup
2022-12-22 13:52             ` Konstantin Ananyev
2022-12-22 15:02               ` Morten Brørup
2022-12-23 16:34                 ` Konstantin Ananyev
2022-12-24 10:46 ` [PATCH v3] " Morten Brørup
2022-12-27  8:54   ` Andrew Rybchenko
2022-12-27 15:37     ` Morten Brørup [this message]

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=98CBD80474FA8B44BF855DF32C47DC35D87601@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=konstantin.ananyev@huawei.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).