From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0E39B1E2F for ; Thu, 3 May 2018 19:18:05 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 10:18:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,359,1520924400"; d="scan'208";a="52955200" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 03 May 2018 10:18:02 -0700 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 w43HI2JQ004215 for ; Thu, 3 May 2018 18:18:02 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w43HI1hZ008903 for ; Thu, 3 May 2018 18:18:01 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w43HI1PJ008898 for dev@dpdk.org; Thu, 3 May 2018 18:18:01 +0100 From: Anatoly Burakov To: dev@dpdk.org Date: Thu, 3 May 2018 18:17:58 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <777ae6b10a7524e188c07ba14e576fc7b0e21018.1524729978.git.anatoly.burakov@intel.com> References: <777ae6b10a7524e188c07ba14e576fc7b0e21018.1524729978.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v3 0/3] Improve zero-length memzone allocation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 17:18:06 -0000 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. 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 | 62 ++--------- lib/librte_eal/common/include/rte_malloc.h | 1 + lib/librte_eal/common/include/rte_memzone.h | 18 ++++ lib/librte_eal/common/malloc_elem.c | 77 ++++++++++++++ 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 | 157 +++++++++++++++------------- 9 files changed, 342 insertions(+), 122 deletions(-) -- 2.7.4