summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-04-04 21:33:25 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-04-04 23:46:04 (GMT)
commit864adb7f4219dc9b920ead049478946f0a42428d (patch)
treedc4d07a8d4bc63cefcd5deea980d7f94afc78794
parent7da04a6b091eb2e3a9fa69bb5f58c18dc10f8e2d (diff)
downloadjemalloc-864adb7f4219dc9b920ead049478946f0a42428d.zip
jemalloc-864adb7f4219dc9b920ead049478946f0a42428d.tar.gz
jemalloc-864adb7f4219dc9b920ead049478946f0a42428d.tar.bz2
Transition e_prof_tctx in struct extent to C11 atomics
-rw-r--r--include/jemalloc/internal/extent_inlines.h6
-rw-r--r--include/jemalloc/internal/extent_structs.h10
2 files changed, 8 insertions, 8 deletions
diff --git a/include/jemalloc/internal/extent_inlines.h b/include/jemalloc/internal/extent_inlines.h
index 99fa67c..e6e447c 100644
--- a/include/jemalloc/internal/extent_inlines.h
+++ b/include/jemalloc/internal/extent_inlines.h
@@ -173,8 +173,8 @@ extent_slab_data_get_const(const extent_t *extent) {
JEMALLOC_INLINE prof_tctx_t *
extent_prof_tctx_get(const extent_t *extent) {
- return (prof_tctx_t *)atomic_read_p(
- &((extent_t *)extent)->e_prof_tctx_pun);
+ return (prof_tctx_t *)atomic_load_p(&extent->e_prof_tctx,
+ ATOMIC_ACQUIRE);
}
JEMALLOC_INLINE void
@@ -272,7 +272,7 @@ extent_slab_set(extent_t *extent, bool slab) {
JEMALLOC_INLINE void
extent_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx) {
- atomic_write_p(&extent->e_prof_tctx_pun, tctx);
+ atomic_store_p(&extent->e_prof_tctx, tctx, ATOMIC_RELEASE);
}
JEMALLOC_INLINE void
diff --git a/include/jemalloc/internal/extent_structs.h b/include/jemalloc/internal/extent_structs.h
index 1527acb..5d41bb8 100644
--- a/include/jemalloc/internal/extent_structs.h
+++ b/include/jemalloc/internal/extent_structs.h
@@ -118,11 +118,11 @@ struct extent_s {
/* Small region slab metadata. */
arena_slab_data_t e_slab_data;
- /* Profile counters, used for large objects. */
- union {
- void *e_prof_tctx_pun;
- prof_tctx_t *e_prof_tctx;
- };
+ /*
+ * Profile counters, used for large objects. Points to a
+ * prof_tctx_t.
+ */
+ atomic_p_t e_prof_tctx;
};
};
typedef ql_head(extent_t) extent_list_t;