summaryrefslogtreecommitdiffstats
path: root/src/arena.c
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-06-15 01:44:13 (GMT)
committerJason Evans <jasone@canonware.com>2017-06-15 03:18:02 (GMT)
commit84f6c2cae0fb1399377ef6aea9368444c4987cc6 (patch)
tree5291cba137446b8923883ba2e4f78254c6033a6d /src/arena.c
parenta4d6fe73cf07b3be3af6b7811cfc5950320bb37f (diff)
downloadjemalloc-84f6c2cae0fb1399377ef6aea9368444c4987cc6.zip
jemalloc-84f6c2cae0fb1399377ef6aea9368444c4987cc6.tar.gz
jemalloc-84f6c2cae0fb1399377ef6aea9368444c4987cc6.tar.bz2
Log decay->nunpurged before purging.
During purging, we may unlock decay->mtx. Therefore we should finish logging decay related counters before attempt to purge.
Diffstat (limited to 'src/arena.c')
-rw-r--r--src/arena.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/arena.c b/src/arena.c
index 0912df3..019dd87 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -725,12 +725,13 @@ arena_decay_epoch_advance(tsdn_t *tsdn, arena_t *arena, arena_decay_t *decay,
arena_decay_epoch_advance_helper(decay, time, current_npages);
size_t npages_limit = arena_decay_backlog_npages_limit(decay);
+ /* We may unlock decay->mtx when try_purge(). Finish logging first. */
+ decay->nunpurged = (npages_limit > current_npages) ? npages_limit :
+ current_npages;
if (purge) {
arena_decay_try_purge(tsdn, arena, decay, extents,
current_npages, npages_limit);
}
- decay->nunpurged = (npages_limit > current_npages) ? npages_limit :
- current_npages;
}
static void