mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
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").
This commit is contained in:
committed by
David Goldblatt
parent
6e62c62862
commit
26c792e61a
@@ -235,7 +235,8 @@ _init_init_lock(void) {
|
||||
* doing anything.
|
||||
*/
|
||||
if (!init_lock_initialized) {
|
||||
malloc_mutex_init(&init_lock, "init", WITNESS_RANK_INIT);
|
||||
malloc_mutex_init(&init_lock, "init", WITNESS_RANK_INIT,
|
||||
malloc_mutex_rank_exclusive);
|
||||
}
|
||||
init_lock_initialized = true;
|
||||
}
|
||||
@@ -1237,7 +1238,8 @@ malloc_init_hard_a0_locked() {
|
||||
if (tcache_boot(TSDN_NULL)) {
|
||||
return true;
|
||||
}
|
||||
if (malloc_mutex_init(&arenas_lock, "arenas", WITNESS_RANK_ARENAS)) {
|
||||
if (malloc_mutex_init(&arenas_lock, "arenas", WITNESS_RANK_ARENAS,
|
||||
malloc_mutex_rank_exclusive)) {
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user