diff options
| author | Jason Evans <jasone@canonware.com> | 2017-03-08 03:18:27 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2017-03-10 18:14:30 (GMT) |
| commit | 3a2b183d5fe86132d0830f720b3b8dbd6a29f7e9 (patch) | |
| tree | cb68395de0d1a89585492aeec176e73c1aeb615f /src | |
| parent | 75fddc786c9d5476cab1d5d4699e95d8907d0b51 (diff) | |
| download | jemalloc-3a2b183d5fe86132d0830f720b3b8dbd6a29f7e9.zip jemalloc-3a2b183d5fe86132d0830f720b3b8dbd6a29f7e9.tar.gz jemalloc-3a2b183d5fe86132d0830f720b3b8dbd6a29f7e9.tar.bz2 | |
Convert arena_t's purging field to non-atomic bool.
The decay mutex already protects all accesses.
Diffstat (limited to 'src')
| -rw-r--r-- | src/arena.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/arena.c b/src/arena.c index a3a1fdd..cb0194a 100644 --- a/src/arena.c +++ b/src/arena.c @@ -777,9 +777,10 @@ arena_purge_to_limit(tsdn_t *tsdn, arena_t *arena, size_t ndirty_limit) { witness_assert_depth_to_rank(tsdn, WITNESS_RANK_CORE, 1); malloc_mutex_assert_owner(tsdn, &arena->decay.mtx); - if (atomic_cas_u(&arena->purging, 0, 1)) { + if (arena->purging) { return; } + arena->purging = true; extent_hooks_t *extent_hooks = extent_hooks_get(arena); size_t npurge, npurged; @@ -809,7 +810,7 @@ arena_purge_to_limit(tsdn_t *tsdn, arena_t *arena, size_t ndirty_limit) { } label_return: - atomic_write_u(&arena->purging, 0); + arena->purging = false; } void @@ -934,7 +935,6 @@ arena_reset(tsd_t *tsd, arena_t *arena) { malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock); } - assert(atomic_read_u(&arena->purging) == 0); atomic_write_zu(&arena->nactive, 0); } @@ -1676,7 +1676,6 @@ arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { arena->dss_prec = extent_dss_prec_get(); - atomic_write_u(&arena->purging, 0); atomic_write_zu(&arena->nactive, 0); if (arena_decay_init(arena, arena_decay_time_default_get())) { @@ -1710,6 +1709,8 @@ arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) { goto label_error; } + arena->purging = false; + if (!config_munmap) { arena->extent_grow_next = psz2ind(HUGEPAGE); } |
