From patchwork Tue Mar 10 08:21:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suanming Mou X-Patchwork-Id: 66489 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69246A0563; Tue, 10 Mar 2020 09:21:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 956A21C00D; Tue, 10 Mar 2020 09:21:25 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id C20E31C002 for ; Tue, 10 Mar 2020 09:21:24 +0100 (CET) From: Suanming Mou To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org Date: Tue, 10 Mar 2020 16:21:17 +0800 Message-Id: <1583828479-204084-1-git-send-email-suanmingm@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH 0/2] bitmap: add create bitmap with all bits set 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently, in the case to use bitmap as resource allocator, after bitmap creation, all the bitmap bits should be set to indicate the bit available. Every time when allocate one bit, search for the set bits and clear it to make it in use. Add a new rte_bitmap_init_with_all_set() function to have a quick fill up the bitmap bits. Comparing with the case create the bitmap as empty and set the bitmap one by one, the new function costs less cycles. For bitmap with 1000 bits, create the bitmap with all bits set costs 754 cycles, while set one by one costs 14194. CPU info as below: Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz Suanming Mou (2): bitmap: add create bitmap with all bits set test/bitmap: add bitmap create with all bits set case app/test/test_bitmap.c | 57 +++++++++++++++++++++++++++++- lib/librte_eal/common/include/rte_bitmap.h | 32 +++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-)