[v2,1/5] bitmap: remove useless code
Checks
Commit Message
RTE_BITMAP_OPTIMIZATIONS was never set to 0 and makes no sense
anyway, so remove all code related to it. Also, drop the "likely"
for bsf64 code, because it's a generic function and we cannot
make any assumptions about likely values of incoming arguments.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/include/rte_bitmap.h | 33 +---------------------
1 file changed, 1 insertion(+), 32 deletions(-)
Comments
> -----Original Message-----
> From: Burakov, Anatoly
> Sent: Wednesday, November 14, 2018 4:30 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> thomas@monjalon.net; Richardson, Bruce <bruce.richardson@intel.com>;
> Yigit, Ferruh <ferruh.yigit@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>
> Subject: [PATCH v2 1/5] bitmap: remove useless code
>
> RTE_BITMAP_OPTIMIZATIONS was never set to 0 and makes no sense
> anyway, so remove all code related to it. Also, drop the "likely"
> for bsf64 code, because it's a generic function and we cannot
> make any assumptions about likely values of incoming arguments.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> lib/librte_eal/common/include/rte_bitmap.h | 33 +---------------------
> 1 file changed, 1 insertion(+), 32 deletions(-)
>
Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
On 14-Nov-18 4:30 PM, Anatoly Burakov wrote:
> RTE_BITMAP_OPTIMIZATIONS was never set to 0 and makes no sense
> anyway, so remove all code related to it. Also, drop the "likely"
> for bsf64 code, because it's a generic function and we cannot
> make any assumptions about likely values of incoming arguments.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
OK, since this requires more rework and can't be merged into 18.11
anyway, i'll mark it as deferred and postpone it till 19.02.
@@ -43,10 +43,6 @@ extern "C" {
#include <rte_branch_prediction.h>
#include <rte_prefetch.h>
-#ifndef RTE_BITMAP_OPTIMIZATIONS
-#define RTE_BITMAP_OPTIMIZATIONS 1
-#endif
-
/* Slab */
#define RTE_BITMAP_SLAB_BIT_SIZE 64
#define RTE_BITMAP_SLAB_BIT_SIZE_LOG2 6
@@ -97,43 +93,16 @@ __rte_bitmap_index2_set(struct rte_bitmap *bmp)
bmp->index2 = (((bmp->index1 << RTE_BITMAP_SLAB_BIT_SIZE_LOG2) + bmp->offset1) << RTE_BITMAP_CL_SLAB_SIZE_LOG2);
}
-#if RTE_BITMAP_OPTIMIZATIONS
-
static inline int
rte_bsf64(uint64_t slab, uint32_t *pos)
{
- if (likely(slab == 0)) {
+ if (slab == 0)
return 0;
- }
*pos = __builtin_ctzll(slab);
return 1;
}
-#else
-
-static inline int
-rte_bsf64(uint64_t slab, uint32_t *pos)
-{
- uint64_t mask;
- uint32_t i;
-
- if (likely(slab == 0)) {
- return 0;
- }
-
- for (i = 0, mask = 1; i < RTE_BITMAP_SLAB_BIT_SIZE; i ++, mask <<= 1) {
- if (unlikely(slab & mask)) {
- *pos = i;
- return 1;
- }
- }
-
- return 0;
-}
-
-#endif
-
static inline uint32_t
__rte_bitmap_get_memory_footprint(uint32_t n_bits,
uint32_t *array1_byte_offset, uint32_t *array1_slabs,