DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Olivier MATZ <olivier.matz@6wind.com>
Cc: <dev@dpdk.org>, <thomas.monjalon@6wind.com>,
	<bruce.richardson@intel.com>,  <konstantin.ananyev@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] mempool: replace c memcpy code semantics with optimized rte_memcpy
Date: Thu, 2 Jun 2016 15:09:37 +0530	[thread overview]
Message-ID: <20160602093936.GB6794@localhost.localdomain> (raw)
In-Reply-To: <574FE202.2060306@6wind.com>

On Thu, Jun 02, 2016 at 09:36:34AM +0200, Olivier MATZ wrote:
> Hi Jerin,
> 
> On 06/01/2016 09:00 AM, Jerin Jacob wrote:
> > On Tue, May 31, 2016 at 11:05:30PM +0200, Olivier MATZ wrote:
> >> Today, the objects pointers are reversed only in the get(). It means
> >> that this code:
> >>
> >> 	rte_mempool_get_bulk(mp, table, 4);
> >> 	for (i = 0; i < 4; i++)
> >> 		printf("obj = %p\n", t[i]);
> >> 	rte_mempool_put_bulk(mp, table, 4);
> >>
> >>
> >> 	printf("-----\n");
> >> 	rte_mempool_get_bulk(mp, table, 4);
> >> 	for (i = 0; i < 4; i++)
> >> 		printf("obj = %p\n", t[i]);
> >> 	rte_mempool_put_bulk(mp, table, 4);
> >>
> >> prints:
> >>
> >> 	addr1
> >> 	addr2
> >> 	addr3
> >> 	addr4
> >> 	-----
> >> 	addr4
> >> 	addr3
> >> 	addr2
> >> 	addr1
> >>
> >> Which is quite strange.
> > 
> > IMO, It is the expected LIFO behavior. Right ?
> > 
> > What is not expected is the following, which is the case after change. Or Am I
> > missing something here?
> > 
> > addr1
> > addr2
> > addr3
> > addr4
> > -----
> > addr1
> > addr2
> > addr3
> > addr4
> > 
> >>
> >> I don't think it would be an issue to replace the loop by a
> >> rte_memcpy(), it may increase the copy speed and it will be
> >> more coherent with the put().
> >>
> 
> I think the LIFO behavior should occur on a per-bulk basis. I mean,
> it should behave like in the exemplaes below:
> 
>   // pool cache is in state X
>   obj1 = mempool_get(mp)
>   obj2 = mempool_get(mp)
>   mempool_put(mp, obj2)
>   mempool_put(mp, obj1)
>   // pool cache is back in state X
> 
>   // pool cache is in state X
>   bulk1 = mempool_get_bulk(mp, 16)
>   bulk2 = mempool_get_bulk(mp, 16)
>   mempool_put_bulk(mp, bulk2, 16)
>   mempool_put_bulk(mp, bulk1, 16)
>   // pool cache is back in state X
> 

Per entry LIFO behavior make more sense in _bulk_ case as recently en-queued buffer
comes out for next "get" makes more chance that buffer in Last level cache.

> Note that today it's not the case for bulks, since object addresses
> are reversed only in get(), we are not back in the original state.
> I don't really see the advantage of this.
> 
> Removing the reversing may accelerate the cache in case of bulk get,
> I think.

I tried in my setup, it was dropping the performance. Have you got
improvement in any setup?

Jerin

> 
> Regards,
> Olivier

  reply	other threads:[~2016-06-02  9:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 14:50 [dpdk-dev] [PATCH] mbuf: " Jerin Jacob
2016-05-24 14:59 ` Olivier Matz
2016-05-24 15:17   ` Jerin Jacob
2016-05-27 10:24     ` Hunt, David
2016-05-27 11:42       ` Jerin Jacob
2016-05-27 15:05         ` Thomas Monjalon
2016-05-30  8:44           ` Olivier Matz
2016-05-27 13:45       ` Hunt, David
2016-06-24 15:56     ` Hunt, David
2016-06-24 16:02       ` Olivier Matz
2016-05-26  8:07 ` [dpdk-dev] [PATCH v2] mempool: " Jerin Jacob
2016-05-30  8:45   ` Olivier Matz
2016-05-31 12:58     ` Jerin Jacob
2016-05-31 21:05       ` Olivier MATZ
2016-06-01  7:00         ` Jerin Jacob
2016-06-02  7:36           ` Olivier MATZ
2016-06-02  9:39             ` Jerin Jacob [this message]
2016-06-02 21:16               ` Olivier MATZ
2016-06-03  7:02                 ` Jerin Jacob
2016-06-17 10:40                   ` Olivier Matz
2016-06-24 16:04                     ` Olivier Matz
2016-06-30  9:41   ` Thomas Monjalon
2016-06-30 11:38     ` Jerin Jacob
2016-06-30 12:16   ` [dpdk-dev] [PATCH v3] " Jerin Jacob
2016-06-30 17:28     ` Thomas Monjalon
2016-07-05  8:43       ` Ferruh Yigit
2016-07-05 11:32         ` Yuanhan Liu
2016-07-05 13:13           ` Jerin Jacob
2016-07-05 13:42             ` Yuanhan Liu
2016-07-05 14:09             ` Ferruh Yigit
2016-07-06 16:21               ` Ferruh Yigit
2016-07-07 13:51                 ` Ferruh Yigit

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=20160602093936.GB6794@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=thomas.monjalon@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).