From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH v6 0/3] Improve zero-length memzone allocation Date: Thu, 31 May 2018 10:50:58 +0100 Message-ID: References: To: dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1F4A04C8C for ; Thu, 31 May 2018 11:51:04 +0200 (CEST) Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w4V9p1XH017697 for ; Thu, 31 May 2018 10:51:01 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w4V9p1rP025267 for ; Thu, 31 May 2018 10:51:01 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w4V9p1tw025247 for dev@dpdk.org; Thu, 31 May 2018 10:51:01 +0100 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. v6: - Rebase on top of 18.05 - Dropped malloc stats changes as no deprecation notice was sent, and i would like to integrate these changes in this release :) v5: - Use bound length if reserving memzone with zero length v4: - Fixes in memzone test - Account for element padding - Fix for wrong memzone size being returned - Documentation fixes Anatoly Burakov (3): malloc: add finding biggest free IOVA-contiguous element malloc: allow reserving biggest element memzone: improve zero-length memzone reserve lib/librte_eal/common/eal_common_memzone.c | 70 ++------- lib/librte_eal/common/include/rte_memzone.h | 24 ++- lib/librte_eal/common/malloc_elem.c | 79 ++++++++++ lib/librte_eal/common/malloc_elem.h | 6 + lib/librte_eal/common/malloc_heap.c | 126 +++++++++++++++ lib/librte_eal/common/malloc_heap.h | 4 + test/test/test_memzone.c | 165 +++++++++++--------- 7 files changed, 343 insertions(+), 131 deletions(-) -- 2.17.0