diff options
author | Jason Evans <jasone@canonware.com> | 2014-10-04 11:12:53 -0700 |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2014-10-04 11:22:55 -0700 |
commit | 029d44cf8b22aa7b749747bfd585887fb59e0030 (patch) | |
tree | 3c6b4b8f8398461b9542103330953ec4dfb46acd /src/tcache.c | |
parent | a4a972d9a163a57183f851535104f4e8ac78f511 (diff) | |
download | jemalloc-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 'src/tcache.c')
-rw-r--r-- | src/tcache.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tcache.c b/src/tcache.c index 6f3408c..07167b6 100644 --- a/src/tcache.c +++ b/src/tcache.c @@ -263,7 +263,8 @@ tcache_get_hard(tsd_t *tsd) { if (!tcache_enabled_get()) { - tcache_enabled_set(false); /* Memoize. */ + if (tsd_nominal(tsd)) + tcache_enabled_set(false); /* Memoize. */ return (NULL); } return (tcache_create(choose_arena(tsd, NULL))); |