mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-17 10:26:27 +03:00
Switch to fine-grained reentrancy support.
Previously we had a general detection and support of reentrancy, at the cost of having branches and inc / dec operations on fast paths. To avoid taxing fast paths, we move the reentrancy operations onto tsd slow state, and only modify reentrancy level around external calls (that might trigger reentrancy).
This commit is contained in:
parent
b348ba29bb
commit
c2fcf9c2cf
8 changed files with 90 additions and 86 deletions
|
|
@ -15,7 +15,8 @@ malloc_tsd_data(, , tsd_t, TSD_INITIALIZER)
|
|||
void
|
||||
tsd_slow_update(tsd_t *tsd) {
|
||||
if (tsd_nominal(tsd)) {
|
||||
if (malloc_slow || !tsd->tcache_enabled) {
|
||||
if (malloc_slow || !tsd->tcache_enabled ||
|
||||
tsd_reentrancy_level_get(tsd) > 0) {
|
||||
tsd->state = tsd_state_nominal_slow;
|
||||
} else {
|
||||
tsd->state = tsd_state_nominal;
|
||||
|
|
@ -28,6 +29,7 @@ tsd_fetch_slow(tsd_t *tsd) {
|
|||
if (tsd->state == tsd_state_nominal_slow) {
|
||||
/* On slow path but no work needed. */
|
||||
assert(malloc_slow || !tsd_tcache_enabled_get(tsd) ||
|
||||
tsd_reentrancy_level_get(tsd) > 0 ||
|
||||
*tsd_arenas_tdata_bypassp_get(tsd));
|
||||
} else if (tsd->state == tsd_state_uninitialized) {
|
||||
tsd->state = tsd_state_nominal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue