From ca21ce4071d14b3cbbb88697bfd76a30b9de7ac8 Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Thu, 30 Jan 2020 12:31:19 -0800 Subject: [PATCH] Emap: Move in write_acquired from extent. --- include/jemalloc/internal/emap.h | 5 +++++ src/emap.c | 10 ++++++++++ src/extent.c | 29 ++++++++++------------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/include/jemalloc/internal/emap.h b/include/jemalloc/internal/emap.h index 9a37b943..b9624d18 100644 --- a/include/jemalloc/internal/emap.h +++ b/include/jemalloc/internal/emap.h @@ -30,4 +30,9 @@ bool emap_rtree_leaf_elms_lookup(tsdn_t *tsdn, emap_t *emap, rtree_ctx_t *rtree_ctx, const edata_t *edata, bool dependent, bool init_missing, rtree_leaf_elm_t **r_elm_a, rtree_leaf_elm_t **r_elm_b); +/* Only temporarily public; this will be internal eventually. */ +void emap_rtree_write_acquired(tsdn_t *tsdn, emap_t *emap, + rtree_leaf_elm_t *elm_a, rtree_leaf_elm_t *elm_b, edata_t *edata, + szind_t szind, bool slab); + #endif /* JEMALLOC_INTERNAL_EMAP_H */ diff --git a/src/emap.c b/src/emap.c index ea3cce0f..4ed9ff11 100644 --- a/src/emap.c +++ b/src/emap.c @@ -125,3 +125,13 @@ emap_rtree_leaf_elms_lookup(tsdn_t *tsdn, emap_t *emap, rtree_ctx_t *rtree_ctx, return false; } + +void +emap_rtree_write_acquired(tsdn_t *tsdn, emap_t *emap, rtree_leaf_elm_t *elm_a, + rtree_leaf_elm_t *elm_b, edata_t *edata, szind_t szind, bool slab) { + rtree_leaf_elm_write(tsdn, &emap->rtree, elm_a, edata, szind, slab); + if (elm_b != NULL) { + rtree_leaf_elm_write(tsdn, &emap->rtree, elm_b, edata, szind, + slab); + } +} diff --git a/src/extent.c b/src/extent.c index bbebf9ed..fc449254 100644 --- a/src/extent.c +++ b/src/extent.c @@ -270,17 +270,6 @@ extent_activate_locked(tsdn_t *tsdn, ecache_t *ecache, edata_t *edata) { edata_state_set(edata, extent_state_active); } -static void -extent_rtree_write_acquired(tsdn_t *tsdn, rtree_leaf_elm_t *elm_a, - rtree_leaf_elm_t *elm_b, edata_t *edata, szind_t szind, bool slab) { - rtree_leaf_elm_write(tsdn, &emap_global.rtree, elm_a, edata, szind, - slab); - if (elm_b != NULL) { - rtree_leaf_elm_write(tsdn, &emap_global.rtree, elm_b, edata, - szind, slab); - } -} - static void extent_interior_register(tsdn_t *tsdn, rtree_ctx_t *rtree_ctx, edata_t *edata, szind_t szind) { @@ -351,7 +340,8 @@ extent_register_impl(tsdn_t *tsdn, edata_t *edata, bool gdump_add) { szind_t szind = edata_szind_get_maybe_invalid(edata); bool slab = edata_slab_get(edata); - extent_rtree_write_acquired(tsdn, elm_a, elm_b, edata, szind, slab); + emap_rtree_write_acquired(tsdn, &emap_global, elm_a, elm_b, edata, + szind, slab); if (slab) { extent_interior_register(tsdn, rtree_ctx, edata, szind); } @@ -415,7 +405,8 @@ extent_deregister_impl(tsdn_t *tsdn, edata_t *edata, bool gdump) { emap_lock_edata(tsdn, &emap_global, edata); - extent_rtree_write_acquired(tsdn, elm_a, elm_b, NULL, SC_NSIZES, false); + emap_rtree_write_acquired(tsdn, &emap_global, elm_a, elm_b, NULL, + SC_NSIZES, false); if (edata_slab_get(edata)) { extent_interior_deregister(tsdn, rtree_ctx, edata); edata_slab_set(edata, false); @@ -1367,10 +1358,10 @@ extent_split_impl(tsdn_t *tsdn, edata_cache_t *edata_cache, ehooks_t *ehooks, edata_size_set(edata, size_a); edata_szind_set(edata, szind_a); - extent_rtree_write_acquired(tsdn, lead_elm_a, lead_elm_b, edata, - szind_a, slab_a); - extent_rtree_write_acquired(tsdn, trail_elm_a, trail_elm_b, trail, - szind_b, slab_b); + emap_rtree_write_acquired(tsdn, &emap_global, lead_elm_a, lead_elm_b, + edata, szind_a, slab_a); + emap_rtree_write_acquired(tsdn, &emap_global, trail_elm_a, trail_elm_b, + trail, szind_b, slab_b); emap_unlock_edata2(tsdn, &emap_global, edata, trail); @@ -1441,8 +1432,8 @@ extent_merge_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_cache_t *edata_cache, edata_sn_get(a) : edata_sn_get(b)); edata_zeroed_set(a, edata_zeroed_get(a) && edata_zeroed_get(b)); - extent_rtree_write_acquired(tsdn, a_elm_a, b_elm_b, a, SC_NSIZES, - false); + emap_rtree_write_acquired(tsdn, &emap_global, a_elm_a, b_elm_b, a, + SC_NSIZES, false); emap_unlock_edata2(tsdn, &emap_global, a, b);