mbox series

[0/2] bitmap: add create bitmap with all bits set

Message ID 1583828479-204084-1-git-send-email-suanmingm@mellanox.com (mailing list archive)
Headers
Series bitmap: add create bitmap with all bits set |

Message

Suanming Mou March 10, 2020, 8:21 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

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(-)
  

Comments

Thomas Monjalon March 25, 2020, 1:25 p.m. UTC | #1
Call for review, please.


10/03/2020 09:21, Suanming Mou:
> 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(-)
> 
>
  
Suanming Mou April 2, 2020, 1:44 p.m. UTC | #2
Ping

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, March 25, 2020 9:26 PM
> To: cristian.dumitrescu@intel.com
> Cc: dev@dpdk.org; Suanming Mou <suanmingm@mellanox.com>
> Subject: Re: [dpdk-dev] [PATCH 0/2] bitmap: add create bitmap with all bits set
> 
> Call for review, please.
> 
> 
> 10/03/2020 09:21, Suanming Mou:
> > 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(-)
> >
> >
> 
> 
> 
>