aboutsummaryrefslogtreecommitdiff
path: root/include/jemalloc/internal/prof.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-09-24 22:14:21 -0700
committerJason Evans <jasone@canonware.com>2014-09-24 22:23:43 -0700
commit6ef80d68f092caf3b3802a73b8d716057b41864c (patch)
tree882a693f70bba8f4494f024b3a5c787fdb9d40f5 /include/jemalloc/internal/prof.h
parenteb5376ab9e61d96daa0d1f03b4474baf5232478f (diff)
downloadjemalloc-6ef80d68f092caf3b3802a73b8d716057b41864c.tar.gz
Fix profile dumping race.
Fix a race that caused a non-critical assertion failure. To trigger the race, a thread had to be part way through initializing a new sample, such that it was discoverable by the dumping thread, but not yet linked into its gctx by the time a later dump phase would normally have reset its state to 'nominal'. Additionally, lock access to the state field during modification to transition to the dumping state. It's not apparent that this oversight could have caused an actual problem due to outer locking that protects the dumping machinery, but the added locking pedantically follows the stated locking protocol for the state field.
Diffstat (limited to 'include/jemalloc/internal/prof.h')
-rw-r--r--include/jemalloc/internal/prof.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/jemalloc/internal/prof.h b/include/jemalloc/internal/prof.h
index b8a8b41..3872c7a 100644
--- a/include/jemalloc/internal/prof.h
+++ b/include/jemalloc/internal/prof.h
@@ -79,6 +79,7 @@ struct prof_cnt_s {
};
typedef enum {
+ prof_tctx_state_initializing,
prof_tctx_state_nominal,
prof_tctx_state_dumping,
prof_tctx_state_purgatory /* Dumper must finish destroying. */