aboutsummaryrefslogtreecommitdiff
path: root/include/jemalloc/internal/prof.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-10-04 11:12:53 -0700
committerJason Evans <jasone@canonware.com>2014-10-04 11:22:55 -0700
commit029d44cf8b22aa7b749747bfd585887fb59e0030 (patch)
tree3c6b4b8f8398461b9542103330953ec4dfb46acd /include/jemalloc/internal/prof.h
parenta4a972d9a163a57183f851535104f4e8ac78f511 (diff)
downloadjemalloc-029d44cf8b22aa7b749747bfd585887fb59e0030.tar.gz
Fix tsd cleanup regressions.
Fix tsd cleanup regressions that were introduced in 5460aa6f6676c7f253bfcb75c028dfd38cae8aaf (Convert all tsd variables to reside in a single tsd structure.). These regressions were twofold: 1) tsd_tryget() should never (and need never) return NULL. Rename it to tsd_fetch() and simplify all callers. 2) tsd_*_set() must only be called when tsd is in the nominal state, because cleanup happens during the nominal-->purgatory transition, and re-initialization must not happen while in the purgatory state. Add tsd_nominal() and use it as needed. Note that tsd_*{p,}_get() can still be used as long as no re-initialization that would require cleanup occurs. This means that e.g. the thread_allocated counter can be updated unconditionally.
Diffstat (limited to 'include/jemalloc/internal/prof.h')
-rw-r--r--include/jemalloc/internal/prof.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/jemalloc/internal/prof.h b/include/jemalloc/internal/prof.h
index 3d3f8f4..0ec7c18 100644
--- a/include/jemalloc/internal/prof.h
+++ b/include/jemalloc/internal/prof.h
@@ -331,8 +331,10 @@ prof_tdata_get(tsd_t *tsd, bool create)
tdata = tsd_prof_tdata_get(tsd);
if (create) {
if (unlikely(tdata == NULL)) {
- tdata = prof_tdata_init(tsd);
- tsd_prof_tdata_set(tsd, tdata);
+ if (tsd_nominal(tsd)) {
+ tdata = prof_tdata_init(tsd);
+ tsd_prof_tdata_set(tsd, tdata);
+ }
} else if (unlikely(tdata->expired)) {
tdata = prof_tdata_reinit(tsd, tdata);
tsd_prof_tdata_set(tsd, tdata);