summaryrefslogtreecommitdiffstats
path: root/src/jemalloc.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-10-13 19:18:38 (GMT)
committerJason Evans <jasone@canonware.com>2016-10-13 22:33:56 (GMT)
commite2bcf037d445a84a71c7997670819ebd0a893b4a (patch)
tree1013805ff2b3e15832529b1141699860677b8a93 /src/jemalloc.c
parent9737685943fedf5796ff157306ca70aaa25750c7 (diff)
downloadjemalloc-e2bcf037d445a84a71c7997670819ebd0a893b4a.zip
jemalloc-e2bcf037d445a84a71c7997670819ebd0a893b4a.tar.gz
jemalloc-e2bcf037d445a84a71c7997670819ebd0a893b4a.tar.bz2
Make dss operations lockless.
Rather than protecting dss operations with a mutex, use atomic operations. This has negligible impact on synchronization overhead during typical dss allocation, but is a substantial improvement for chunk_in_dss() and the newly added chunk_dss_mergeable(), which can be called multiple times during chunk deallocations. This change also has the advantage of avoiding tsd in deallocation paths associated with purging, which resolves potential deadlocks during thread exit due to attempted tsd resurrection. This resolves #425.
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r--src/jemalloc.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index aec2a5e..b0ebf81 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -1115,8 +1115,7 @@ malloc_conf_init(void)
for (i = 0; i < dss_prec_limit; i++) {
if (strncmp(dss_prec_names[i], v, vlen)
== 0) {
- if (chunk_dss_prec_set(NULL,
- i)) {
+ if (chunk_dss_prec_set(i)) {
malloc_conf_error(
"Error setting dss",
k, klen, v, vlen);
@@ -2783,7 +2782,6 @@ _malloc_prefork(void)
}
}
base_prefork(tsd_tsdn(tsd));
- chunk_prefork(tsd_tsdn(tsd));
for (i = 0; i < narenas; i++) {
if ((arena = arena_get(tsd_tsdn(tsd), i, false)) != NULL)
arena_prefork3(tsd_tsdn(tsd), arena);
@@ -2812,7 +2810,6 @@ _malloc_postfork(void)
witness_postfork_parent(tsd);
/* Release all mutexes, now that fork() has completed. */
- chunk_postfork_parent(tsd_tsdn(tsd));
base_postfork_parent(tsd_tsdn(tsd));
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
arena_t *arena;
@@ -2837,7 +2834,6 @@ jemalloc_postfork_child(void)
witness_postfork_child(tsd);
/* Release all mutexes, now that fork() has completed. */
- chunk_postfork_child(tsd_tsdn(tsd));
base_postfork_child(tsd_tsdn(tsd));
for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
arena_t *arena;