DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Dai, Wei" <wei.dai@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"Gonzalez Monroy, Sergio" <sergio.gonzalez.monroy@intel.com>,
	"Tan, Jianfeng" <jianfeng.tan@intel.com>
Subject: Re: [dpdk-dev] [PATCH] mempool: fix search of maximum contiguous pages
Date: Thu, 13 Oct 2016 12:31:42 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB9772583F0C12EF@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <49759EB36A64CF4892C1AFEC9231E8D63A2D3E10@PGSMSX106.gar.corp.intel.com>


> 
> > > > diff --git a/lib/librte_mempool/rte_mempool.c
> > > > b/lib/librte_mempool/rte_mempool.c
> > > > index 71017e1..e3e254a 100644
> > > > --- a/lib/librte_mempool/rte_mempool.c
> > > > +++ b/lib/librte_mempool/rte_mempool.c
> > > > @@ -426,9 +426,12 @@ rte_mempool_populate_phys_tab(struct
> > > > rte_mempool *mp, char *vaddr,
> > > >
> > > >  	for (i = 0; i < pg_num && mp->populated_size < mp->size; i += n) {
> > > >
> > > > +		phys_addr_t paddr_next;
> > > > +		paddr_next = paddr[i] + pg_sz;
> > > > +
> > > >  		/* populate with the largest group of contiguous pages */
> > > >  		for (n = 1; (i + n) < pg_num &&
> > > > -			     paddr[i] + pg_sz == paddr[i+n]; n++)
> > > > +			     paddr_next == paddr[i+n]; n++, paddr_next += pg_sz)
> > > >  			;
> > >
> > > Good catch.
> > > Why not just paddr[i + n - 1] != paddr[i + n]?
> >
> > Sorry, I meant 'paddr[i + n - 1] + pg_sz == paddr[i+n]' off course.
> >
> > > Then you don't need extra variable (paddr_next) here.
> > > Konstantin
> 
> Thank you, Konstantin
> 'paddr[i + n - 1] + pg_sz = paddr[i + n]' also can fix it and have straight meaning.
> But I assume that my revision with paddr_next += pg_sz may have a bit better performance.

I don't think there would be any real difference, again it is not performance critical code-path.

> By the way, paddr[i] + n * pg_sz = paddr[i + n] can also resolve it.

Yes, that's one seems even better for me - make things more clear.
Konstantin

> 
> /Wei
> 
> > >
> > > >
> > > >  		ret = rte_mempool_populate_phys(mp, vaddr + i * pg_sz,
> > > > --
> > > > 2.7.4

  reply	other threads:[~2016-10-13 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13  9:37 Wei Dai
2016-10-13  9:46 ` Sergio Gonzalez Monroy
2016-10-13  9:53 ` Ananyev, Konstantin
2016-10-13  9:59   ` Ananyev, Konstantin
2016-10-13 11:52     ` Dai, Wei
2016-10-13 12:31       ` Ananyev, Konstantin [this message]
2016-10-13 15:05         ` Olivier MATZ
2016-10-25 14:37           ` Thomas Monjalon
2016-10-25 14:56             ` Olivier Matz
2016-10-25 15:01 ` [dpdk-dev] [PATCH v2] " Olivier Matz
2016-10-25 21:23   ` [dpdk-dev] [dpdk-stable] " 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=2601191342CEEE43887BDE71AB9772583F0C12EF@irsmsx105.ger.corp.intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=wei.dai@intel.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).