diff options
author | David Goldblatt <davidgoldblatt@fb.com> | 2017-05-15 22:38:15 (GMT) |
---|---|---|
committer | David Goldblatt <davidtgoldblatt@gmail.com> | 2017-05-19 21:21:27 (GMT) |
commit | 26c792e61a163b38b373023bca2947283dcd1fc8 (patch) | |
tree | 89c4b0e1275707f6e671a23ad6ed548484becabc /src/base.c | |
parent | 6e62c6286258e340308b4a989b4bd80232fed8e1 (diff) | |
download | jemalloc-26c792e61a163b38b373023bca2947283dcd1fc8.zip jemalloc-26c792e61a163b38b373023bca2947283dcd1fc8.tar.gz jemalloc-26c792e61a163b38b373023bca2947283dcd1fc8.tar.bz2 |
Allow mutexes to take a lock ordering enum at construction.
This lets us specify whether and how mutexes of the same rank are allowed to be
acquired. Currently, we only allow two polices (only a single mutex at a given
rank at a time, and mutexes acquired in ascending order), but we can plausibly
allow more (e.g. the "release uncontended mutexes before blocking").
Diffstat (limited to 'src/base.c')
-rw-r--r-- | src/base.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -238,7 +238,8 @@ base_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { &gap_size, base_size, base_alignment); base->ind = ind; atomic_store_p(&base->extent_hooks, extent_hooks, ATOMIC_RELAXED); - if (malloc_mutex_init(&base->mtx, "base", WITNESS_RANK_BASE)) { + if (malloc_mutex_init(&base->mtx, "base", WITNESS_RANK_BASE, + malloc_mutex_rank_exclusive)) { base_unmap(extent_hooks, ind, block, block->size); return NULL; } |