memzone: fix size on reserving biggest memzone
authorAnatoly Burakov <anatoly.burakov@intel.com>
Thu, 3 May 2018 16:00:47 +0000 (17:00 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 14 May 2018 00:10:36 +0000 (02:10 +0200)
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 <anatoly.burakov@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_eal/common/eal_common_memzone.c

index 28f39e2..faa3b06 100644 (file)
@@ -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;