From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH v4 0/3] Improve zero-length memzone allocation Date: Mon, 14 May 2018 12:19:52 +0100 Message-ID: References: Cc: remy.horton@intel.com To: dev@dpdk.org Return-path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 428FE1C7B0 for ; Mon, 14 May 2018 13:19:58 +0200 (CEST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patchset does two things. First, it enables reserving memzones of zero-length that are IOVA-contiguous. Second, it fixes a long-standing race condition in reserving zero-length memzones, where malloc heap is not locked between stats collection and reservation, and will instead allocate biggest element on the spot. Some limitations are added, but they are a trade-off between not having race conditions and user convenience. It would be possible to lock all heaps during memzone reserve for zero- length, and that would keep the old behavior, but given how such allocation (especially when asking for IOVA-contiguous memory) may take a long time, a design decision was made to keep things simple, and only check other heaps if the current one is completely busy. Ideas on improvement are welcome. v4: - Fixes in memzone test - Account for element padding - Fix for wrong memzone size being returned - Documentation fixes Anatoly Burakov (3): malloc: add biggest free IOVA-contiguous element to stats malloc: allow reserving biggest element memzone: improve zero-length memzone reserve lib/librte_eal/common/eal_common_memzone.c | 68 +++--------- lib/librte_eal/common/include/rte_malloc.h | 1 + lib/librte_eal/common/include/rte_memzone.h | 21 ++++ lib/librte_eal/common/malloc_elem.c | 79 +++++++++++++ lib/librte_eal/common/malloc_elem.h | 6 + lib/librte_eal/common/malloc_heap.c | 137 +++++++++++++++++++++++ lib/librte_eal/common/malloc_heap.h | 4 + lib/librte_eal/common/rte_malloc.c | 2 + test/test/test_memzone.c | 165 ++++++++++++++++------------ 9 files changed, 358 insertions(+), 125 deletions(-) -- 2.7.4