aboutsummaryrefslogtreecommitdiff
path: root/include/jemalloc/internal/chunk.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2015-01-30 22:54:08 -0800
committerJason Evans <jasone@canonware.com>2015-02-04 16:51:53 -0800
commit8d0e04d42f4750970ac3052a6c76379b60aba5dc (patch)
tree25d71a94a914eb4f69c524f14b5f8d28eaf01881 /include/jemalloc/internal/chunk.h
parentc810fcea1fa7983ef5bcabe6556cdc19dde6dd8d (diff)
downloadjemalloc-8d0e04d42f4750970ac3052a6c76379b60aba5dc.tar.gz
Refactor rtree to be lock-free.
Recent huge allocation refactoring associates huge allocations with arenas, but it remains necessary to quickly look up huge allocation metadata during reallocation/deallocation. A global radix tree remains a good solution to this problem, but locking would have become the primary bottleneck after (upcoming) migration of chunk management from global to per arena data structures. This lock-free implementation uses double-checked reads to traverse the tree, so that in the steady state, each read or write requires only a single atomic operation. This implementation also assures that no more than two tree levels actually exist, through a combination of careful virtual memory allocation which makes large sparse nodes cheap, and skipping the root node on x64 (possible because the top 16 bits are all 0 in practice).
Diffstat (limited to 'include/jemalloc/internal/chunk.h')
-rw-r--r--include/jemalloc/internal/chunk.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/jemalloc/internal/chunk.h b/include/jemalloc/internal/chunk.h
index 764b7ac..62ac3e7 100644
--- a/include/jemalloc/internal/chunk.h
+++ b/include/jemalloc/internal/chunk.h
@@ -35,7 +35,7 @@ extern malloc_mutex_t chunks_mtx;
/* Chunk statistics. */
extern chunk_stats_t stats_chunks;
-extern rtree_t *chunks_rtree;
+extern rtree_t chunks_rtree;
extern size_t chunksize;
extern size_t chunksize_mask; /* (chunksize - 1). */