From a82377cab87cea35bdd135fa8b8c4c485e2389f7 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Thu, 3 May 2018 17:00:47 +0100 Subject: [PATCH] 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 --- lib/librte_eal/common/eal_common_memzone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.20.1