From b6c0867142ced63a21003b2f449b20b248e1cc4a Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Mon, 3 Oct 2016 10:37:12 -0700 Subject: [PATCH] Reduce "thread.arena" mallctl contention. This resolves #460. --- src/ctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ctl.c b/src/ctl.c index 535f1eab..87fd8c75 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -1186,14 +1186,13 @@ thread_arena_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, if (oldarena == NULL) return (EAGAIN); - malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx); newind = oldind = oldarena->ind; WRITE(newind, unsigned); READ(oldind, unsigned); if (newind != oldind) { arena_t *newarena; - if (newind >= ctl_stats.narenas) { + if (newind >= narenas_total_get()) { /* New arena index is out of range. */ ret = EFAULT; goto label_return; @@ -1218,7 +1217,6 @@ thread_arena_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, ret = 0; label_return: - malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx); return (ret); }