From: Anatoly Burakov Date: Thu, 3 May 2018 16:00:47 +0000 (+0100) Subject: memzone: fix size on reserving biggest memzone X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a82377cab87cea35bdd135fa8b8c4c485e2389f7;p=dpdk.git memzone: fix size on reserving biggest memzone Size of malloc heap elements include overhead, which should not be counted as part of memzone. Fixes: fafcc11985a2 ("mem: rework memzone to be allocated by malloc") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov Acked-by: Konstantin Ananyev --- diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c index 28f39e227b..faa3b0615f 100644 --- a/lib/librte_eal/common/eal_common_memzone.c +++ b/lib/librte_eal/common/eal_common_memzone.c @@ -213,7 +213,8 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len, snprintf(mz->name, sizeof(mz->name), "%s", name); mz->iova = rte_malloc_virt2iova(mz_addr); mz->addr = mz_addr; - mz->len = (requested_len == 0 ? elem->size : requested_len); + mz->len = (requested_len == 0 ? + (elem->size - MALLOC_ELEM_OVERHEAD) : requested_len); mz->hugepage_sz = elem->msl->page_sz; mz->socket_id = elem->msl->socket_id; mz->flags = 0;