summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-05-23 00:08:21 (GMT)
committerJason Evans <jasone@canonware.com>2017-05-23 22:31:29 (GMT)
commit9b1038d19c998b8c219eb08d083ca0328b7941f1 (patch)
tree79087271b006f48a10b0103f168061125ab8f614 /src
parenteeefdf3ce89e09ce7cc5c58d2a3730b83045eec1 (diff)
downloadjemalloc-9b1038d19c998b8c219eb08d083ca0328b7941f1.zip
jemalloc-9b1038d19c998b8c219eb08d083ca0328b7941f1.tar.gz
jemalloc-9b1038d19c998b8c219eb08d083ca0328b7941f1.tar.bz2
Do not hold the base mutex while calling extent hooks.
Drop the base mutex while allocating new base blocks, because extent allocation can enter code that prohibits holding non-core mutexes, e.g. the extent_[d]alloc() and extent_purge_forced_wrapper() calls in extent_alloc_dss(). This partially resolves #802.
Diffstat (limited to 'src')
-rw-r--r--src/base.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/base.c b/src/base.c
index 7502a65..dd4b109 100644
--- a/src/base.c
+++ b/src/base.c
@@ -199,8 +199,14 @@ base_extent_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment) {
malloc_mutex_assert_owner(tsdn, &base->mtx);
extent_hooks_t *extent_hooks = base_extent_hooks_get(base);
+ /*
+ * Drop mutex during base_block_alloc(), because an extent hook will be
+ * called.
+ */
+ malloc_mutex_unlock(tsdn, &base->mtx);
base_block_t *block = base_block_alloc(extent_hooks, base_ind_get(base),
&base->pind_last, &base->extent_sn_next, size, alignment);
+ malloc_mutex_lock(tsdn, &base->mtx);
if (block == NULL) {
return NULL;
}