[dpdk-dev] [PATCH v3 20/35] mempool: allocate in several memory chunks by default

Ferruh Yigit ferruh.yigit at intel.com
Wed Jun 1 05:37:54 CEST 2016


On 5/18/2016 12:04 PM, Olivier Matz wrote:
> Introduce rte_mempool_populate_default() which allocates
> mempool objects in several memzones.
> 
> The mempool header is now always allocated in a specific memzone
> (not with its objects). Thanks to this modification, we can remove
> many specific behavior that was required when hugepages are not
> enabled in case we are using rte_mempool_xmem_create().
> 
> This change requires to update how kni and mellanox drivers lookup for
> mbuf memory. For now, this will only work if there is only one memory
> chunk (like today), but we could make use of rte_mempool_mem_iter() to
> support more memory chunks.
> 
> We can also remove RTE_MEMPOOL_OBJ_NAME that is not required anymore for
> the lookup, as memory chunks are referenced by the mempool.
> 
> Note that rte_mempool_create() is still broken (it was the case before)
> when there is no hugepages support (rte_mempool_create_xmem() has to be
> used). This is fixed in next commit.
> 
> Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
> ---

<snip>

> -	if (vaddr == NULL) {
> -		/* calculate address of the first elt for continuous mempool. */
> -		obj = (char *)mp + MEMPOOL_HEADER_SIZE(mp, cache_size) +
> -			private_data_size;
> -		obj = RTE_PTR_ALIGN_CEIL(obj, RTE_MEMPOOL_ALIGN);
> -
> -		ret = rte_mempool_populate_phys(mp, obj,
> -			mp->phys_addr + ((char *)obj - (char *)mp),
> -			objsz.total_size * n, NULL, NULL);
> -		if (ret != (int)mp->size)
> -			goto exit_unlock;
> -	} else {
> +	if (vaddr == NULL)
> +		ret = rte_mempool_populate_default(mp);

This breaks current ivshmem code, since now mp has multiple mz.
I will send a patch for ivshmem.

<snip>


More information about the dev mailing list