mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-03 17:10:32 +03:00
Synchronize arena->tcache_ql with arena->tcache_ql_mtx.
This replaces arena->lock synchronization.
This commit is contained in:
parent
6b5cba4191
commit
ab25d3c987
5 changed files with 31 additions and 21 deletions
|
|
@ -684,17 +684,12 @@ stats_print_atexit(void) {
|
|||
if (arena != NULL) {
|
||||
tcache_t *tcache;
|
||||
|
||||
/*
|
||||
* tcache_stats_merge() locks bins, so if any
|
||||
* code is introduced that acquires both arena
|
||||
* and bin locks in the opposite order,
|
||||
* deadlocks may result.
|
||||
*/
|
||||
malloc_mutex_lock(tsdn, &arena->lock);
|
||||
malloc_mutex_lock(tsdn, &arena->tcache_ql_mtx);
|
||||
ql_foreach(tcache, &arena->tcache_ql, link) {
|
||||
tcache_stats_merge(tsdn, tcache, arena);
|
||||
}
|
||||
malloc_mutex_unlock(tsdn, &arena->lock);
|
||||
malloc_mutex_unlock(tsdn,
|
||||
&arena->tcache_ql_mtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue