summaryrefslogtreecommitdiffstats
path: root/include/jemalloc
diff options
context:
space:
mode:
authorDave Watson <davejwatson@fb.com>2018-10-29 23:01:09 (GMT)
committerDave Watson <davejwatson@fb.com>2018-11-14 15:09:11 (GMT)
commit13c237c7ef5baa63c820539e0cfef4c4c5c74ea2 (patch)
tree0b224943c88d91f156d053e0e107f0515b45b6ff /include/jemalloc
parent17aa470760cefb3057be746f7022196035f0cfbe (diff)
downloadjemalloc-13c237c7ef5baa63c820539e0cfef4c4c5c74ea2.zip
jemalloc-13c237c7ef5baa63c820539e0cfef4c4c5c74ea2.tar.gz
jemalloc-13c237c7ef5baa63c820539e0cfef4c4c5c74ea2.tar.bz2
Add a fastpath for arena_slab_reg_alloc_batch
Also adds a configure.ac check for __builtin_popcount, which is used in the new fastpath.
Diffstat (limited to 'include/jemalloc')
-rw-r--r--include/jemalloc/internal/bit_util.h19
-rw-r--r--include/jemalloc/internal/jemalloc_internal_defs.h.in6
2 files changed, 25 insertions, 0 deletions
diff --git a/include/jemalloc/internal/bit_util.h b/include/jemalloc/internal/bit_util.h
index 8c59c39..c045eb8 100644
--- a/include/jemalloc/internal/bit_util.h
+++ b/include/jemalloc/internal/bit_util.h
@@ -27,6 +27,25 @@ ffs_u(unsigned bitmap) {
return JEMALLOC_INTERNAL_FFS(bitmap);
}
+#ifdef JEMALLOC_INTERNAL_POPCOUNTL
+BIT_UTIL_INLINE unsigned
+popcount_lu(unsigned long bitmap) {
+ return JEMALLOC_INTERNAL_POPCOUNTL(bitmap);
+}
+#endif
+
+/*
+ * Clears first unset bit in bitmap, and returns
+ * place of bit. bitmap *must not* be 0.
+ */
+
+BIT_UTIL_INLINE size_t
+cfs_lu(unsigned long* bitmap) {
+ size_t bit = ffs_lu(*bitmap) - 1;
+ *bitmap ^= ZU(1) << bit;
+ return bit;
+}
+
BIT_UTIL_INLINE unsigned
ffs_zu(size_t bitmap) {
#if LG_SIZEOF_PTR == LG_SIZEOF_INT
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
index c1eb8ed..3eac275 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -237,6 +237,12 @@
#undef JEMALLOC_INTERNAL_FFS
/*
+ * popcount*() functions to use for bitmapping.
+ */
+#undef JEMALLOC_INTERNAL_POPCOUNTL
+#undef JEMALLOC_INTERNAL_POPCOUNT
+
+/*
* If defined, explicitly attempt to more uniformly distribute large allocation
* pointer alignments across all cache indices.
*/