DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	thomas@monjalon.net,  bruce.richardson@intel.com,
	ferruh.yigit@intel.com, jasvinder.singh@intel.com
Subject: [dpdk-dev] [PATCH v3 1/5] bitmap: remove useless code
Date: Wed, 14 Nov 2018 16:47:06 +0000	[thread overview]
Message-ID: <fbc68e4e563904b7758950cc50ecf0f753f4ec53.1542213812.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <fbc68e4e563904b7758950cc50ecf0f753f4ec53.1542212598.git.anatoly.burakov@intel.com>

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>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_eal/common/include/rte_bitmap.h | 33 +---------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_bitmap.h b/lib/librte_eal/common/include/rte_bitmap.h
index 7a36ce73c..d2ed6204c 100644
--- a/lib/librte_eal/common/include/rte_bitmap.h
+++ b/lib/librte_eal/common/include/rte_bitmap.h
@@ -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,
-- 
2.17.1

  parent reply	other threads:[~2018-11-14 16:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 12:11 [dpdk-dev] [PATCH] bitmap: deprecate rte_bsf64 Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 1/5] bitmap: remove useless code Anatoly Burakov
2018-11-14 16:40   ` Dumitrescu, Cristian
2018-11-14 16:47   ` Anatoly Burakov [this message]
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 2/5] bitmap: rename rte_bsf64 and move to common header Anatoly Burakov
2018-11-14 16:52     ` Singh, Jasvinder
2018-11-22 16:54       ` Hunt, David
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 3/5] common: add missing implementations Anatoly Burakov
2018-11-15  8:40     ` Jerin Jacob
2018-11-15 10:07       ` Burakov, Anatoly
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 4/5] memalloc: use library implementation of 64-bit log2 Anatoly Burakov
2018-11-14 16:47   ` [dpdk-dev] [PATCH v3 5/5] testpmd: " Anatoly Burakov
2018-11-15 10:08   ` [dpdk-dev] [PATCH v2 1/5] bitmap: remove useless code Burakov, Anatoly
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 2/5] bitmap: rename rte_bsf64 and move to common header Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 3/5] common: add missing implementations Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 4/5] memalloc: use library implementation of 64-bit log2 Anatoly Burakov
2018-11-14 16:30 ` [dpdk-dev] [PATCH v2 5/5] testpmd: " Anatoly Burakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fbc68e4e563904b7758950cc50ecf0f753f4ec53.1542213812.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jasvinder.singh@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).