[dpdk-dev] [PATCH] mempool: fix slow allocation of large mempools
Olivier Matz
olivier.matz at 6wind.com
Thu Jan 9 18:27:41 CET 2020
Hi Ali,
On Thu, Jan 09, 2020 at 04:06:53PM +0000, Ali Alnubani wrote:
> Hi Olivier,
>
> > -----Original Message-----
> > From: dev <dev-bounces at dpdk.org> On Behalf Of Olivier Matz
> > Sent: Thursday, January 9, 2020 3:28 PM
> > To: dev at dpdk.org
> > Cc: Andrew Rybchenko <arybchenko at solarflare.com>; Anatoly Burakov
> > <anatoly.burakov at intel.com>; stable at dpdk.org
> > Subject: [dpdk-dev] [PATCH] mempool: fix slow allocation of large mempools
> >
> > When allocating a mempool which is larger than the largest available area, it
> > can take a lot of time:
> >
> > a- the mempool calculate the required memory size, and tries
> > to allocate it, it fails
> > b- then it tries to allocate the largest available area (this
> > does not request new huge pages)
> > c- add this zone to the mempool, this triggers the allocation
> > of a mem hdr, which request a new huge page
> > d- back to a- until mempool is populated or until there is no
> > more memory
> >
> > This can take a lot of time to finally fail (several minutes): in step
> > a- it takes all available hugepages on the system, then release them after it
> > fails.
> >
> > The problem appeared with commit eba11e364614 ("mempool: reduce
> > wasted space on populate"), because smaller chunks are now allowed.
> > Previously, it had to be at least one page size, which is not the case in step b-.
> >
> > To fix this, implement our own way to allocate the largest available area
> > instead of using the feature from memzone: if an allocation fails, try to divide
> > the size by 2 and retry. When the requested size falls below min_chunk_size,
> > stop and return an error.
> >
> > Fixes: eba11e364614 ("mempool: reduce wasted space on populate")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> > ---
>
> Testpmd (testpmd -n4 -- -i) fails to start after applying this patch with:
> """
> EAL: Error - exiting with code: 1
> Cause: Creation of mbuf pool for socket 0 failed: File exists
> """
>
> This is why the check ci/iol-mellanox-Performance is failing (not sure if the other tests are failing for the same reason).
Thanks for the report.
I should have retested after my "little rework"... :)
I'll send a v2 with this fix:
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -572,7 +572,7 @@ rte_mempool_populate_default(struct rte_mempool *mp)
max_alloc_size = RTE_MIN(max_alloc_size,
(size_t)mem_size) / 2;
- } while (max_alloc_size >= min_chunk_size);
+ } while (mz == NULL && max_alloc_size >= min_chunk_size);
if (mz == NULL) {
ret = -rte_errno;
Olivier
More information about the dev
mailing list