summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mheap_bootstrap.h
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-05-17 20:20:50 -0400
committerDamjan Marion <dmarion.lists@gmail.com>2017-05-18 15:38:52 +0000
commitba7ddfe9b77771c47f99df5475e6e92b8d80816e (patch)
tree3c04fc256af5828fbaf1934bb2f91ae7daadbbee /src/vppinfra/mheap_bootstrap.h
parent287ca3c9162456a93380f55090354e3ce0e7cb2f (diff)
VPP-847: improve bihash template memory allocator performance
Particularly in the DCLIB_VEC64=1 case, using vectors vs. raw clib_mem_alloc'ed memory causes abysmal memory allocator performance. Change-Id: I07a4dec0cd69ca357445385e2671cdf23c59b95d Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vppinfra/mheap_bootstrap.h')
-rw-r--r--src/vppinfra/mheap_bootstrap.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/vppinfra/mheap_bootstrap.h b/src/vppinfra/mheap_bootstrap.h
index 4b21051bfcc..38f0ac84fa9 100644
--- a/src/vppinfra/mheap_bootstrap.h
+++ b/src/vppinfra/mheap_bootstrap.h
@@ -160,11 +160,23 @@ typedef struct
uword *trace_index_by_offset;
} mheap_trace_main_t;
+/* Without vector instructions don't bother with small object cache. */
+#ifdef CLIB_HAVE_VEC128
+#define MHEAP_HAVE_SMALL_OBJECT_CACHE 1
+#else
+#define MHEAP_HAVE_SMALL_OBJECT_CACHE 0
+#endif
+
/* Small object bin i is for objects with
user_size > sizeof (mheap_elt_t) + sizeof (mheap_elt_t) * (i - 1)
user_size <= sizeof (mheap_elt_t) + sizeof (mheap_size_t) * i. */
+#if MHEAP_HAVE_SMALL_OBJECT_CACHE > 0
#define MHEAP_LOG2_N_SMALL_OBJECT_BINS 8
#define MHEAP_N_SMALL_OBJECT_BINS (1 << MHEAP_LOG2_N_SMALL_OBJECT_BINS)
+#else
+#define MHEAP_LOG2_N_SMALL_OBJECT_BINS 0
+#define MHEAP_N_SMALL_OBJECT_BINS 0
+#endif
#define MHEAP_N_BINS \
(MHEAP_N_SMALL_OBJECT_BINS \
@@ -188,18 +200,6 @@ typedef struct
u64 n_clocks_get, n_clocks_put;
} mheap_stats_t;
-/* Without vector instructions don't bother with small object cache. */
-#ifdef CLIB_HAVE_VEC128
-#define MHEAP_HAVE_SMALL_OBJECT_CACHE 1
-#else
-#define MHEAP_HAVE_SMALL_OBJECT_CACHE 0
-#endif
-
-#if CLIB_VEC64 > 0
-#undef MHEAP_HAVE_SMALL_OBJECT_CACHE
-#define MHEAP_HAVE_SMALL_OBJECT_CACHE 0
-#endif
-
/* For objects with align == 4 and align_offset == 0 (e.g. vector strings). */
typedef struct
{