[v2,0/2] bitmap: add create bitmap with all bits set
Message ID | 1586315145-6633-1-git-send-email-suanmingm@mellanox.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 0CA7FA0597; Wed, 8 Apr 2020 05:05:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DDEB41BF31; Wed, 8 Apr 2020 05:05:50 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id F08B42B86 for <dev@dpdk.org>; Wed, 8 Apr 2020 05:05:49 +0200 (CEST) From: Suanming Mou <suanmingm@mellanox.com> To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org, amo@semihalf.com Date: Wed, 8 Apr 2020 11:05:43 +0800 Message-Id: <1586315145-6633-1-git-send-email-suanmingm@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1583828479-204084-1-git-send-email-suanmingm@mellanox.com> References: <1583828479-204084-1-git-send-email-suanmingm@mellanox.com> Subject: [dpdk-dev] [PATCH v2 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 <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Message
Suanming Mou
April 8, 2020, 3:05 a.m. UTC
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 v2 updates: 1. Split the common part to __rte_bitmap_init(). 2. Set the slab bits more customized. 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 | 113 ++++++++++++++++++++++------- 2 files changed, 141 insertions(+), 29 deletions(-)