From 44f5f5360598b57b9d701f6b544f5cd2acd4df9c Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Thu, 30 Jan 2020 15:02:52 -0800 Subject: [PATCH] Emap: Move over deregistration functions. --- include/jemalloc/internal/emap.h | 2 ++ src/emap.c | 11 +++++++++++ src/extent.c | 25 ++----------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/include/jemalloc/internal/emap.h b/include/jemalloc/internal/emap.h index eef33f27..d28a5f79 100644 --- a/include/jemalloc/internal/emap.h +++ b/include/jemalloc/internal/emap.h @@ -67,5 +67,7 @@ void emap_register_interior(tsdn_t *tsdn, emap_t *emap, rtree_ctx_t *rtree_ctx, void emap_deregister_boundary(tsdn_t *tsdn, emap_t *emap, rtree_ctx_t *rtree_ctx, edata_t *edata); +void emap_deregister_interior(tsdn_t *tsdn, emap_t *emap, + rtree_ctx_t *rtree_ctx, edata_t *edata); #endif /* JEMALLOC_INTERNAL_EMAP_H */ diff --git a/src/emap.c b/src/emap.c index d54cf7e9..92814fcc 100644 --- a/src/emap.c +++ b/src/emap.c @@ -172,3 +172,14 @@ emap_deregister_boundary(tsdn_t *tsdn, emap_t *emap, rtree_ctx_t *rtree_ctx, emap_rtree_write_acquired(tsdn, emap, elm_a, elm_b, NULL, SC_NSIZES, false); } + +void +emap_deregister_interior(tsdn_t *tsdn, emap_t *emap, rtree_ctx_t *rtree_ctx, + edata_t *edata) { + assert(edata_slab_get(edata)); + for (size_t i = 1; i < (edata_size_get(edata) >> LG_PAGE) - 1; i++) { + rtree_clear(tsdn, &emap->rtree, rtree_ctx, + (uintptr_t)edata_base_get(edata) + (uintptr_t)(i << + LG_PAGE)); + } +} diff --git a/src/extent.c b/src/extent.c index 2b2ba7ea..bb88c202 100644 --- a/src/extent.c +++ b/src/extent.c @@ -357,27 +357,6 @@ extent_reregister(tsdn_t *tsdn, edata_t *edata) { assert(!err); } -/* - * Removes all pointers to the given extent from the global rtree indices for - * its interior. This is relevant for slab extents, for which we need to do - * metadata lookups at places other than the head of the extent. We deregister - * on the interior, then, when an extent moves from being an active slab to an - * inactive state. - */ -static void -extent_interior_deregister(tsdn_t *tsdn, rtree_ctx_t *rtree_ctx, - edata_t *edata) { - size_t i; - - assert(edata_slab_get(edata)); - - for (i = 1; i < (edata_size_get(edata) >> LG_PAGE) - 1; i++) { - rtree_clear(tsdn, &emap_global.rtree, rtree_ctx, - (uintptr_t)edata_base_get(edata) + (uintptr_t)(i << - LG_PAGE)); - } -} - /* * Removes all pointers to the given extent from the global rtree. */ @@ -389,7 +368,7 @@ extent_deregister_impl(tsdn_t *tsdn, edata_t *edata, bool gdump) { emap_lock_edata(tsdn, &emap_global, edata); emap_deregister_boundary(tsdn, &emap_global, rtree_ctx, edata); if (edata_slab_get(edata)) { - extent_interior_deregister(tsdn, rtree_ctx, edata); + emap_deregister_interior(tsdn, &emap_global, rtree_ctx, edata); edata_slab_set(edata, false); } emap_unlock_edata(tsdn, &emap_global, edata); @@ -1073,7 +1052,7 @@ extent_record(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, ecache_t *ecache, edata_szind_set(edata, SC_NSIZES); if (edata_slab_get(edata)) { - extent_interior_deregister(tsdn, rtree_ctx, edata); + emap_deregister_interior(tsdn, &emap_global, rtree_ctx, edata); edata_slab_set(edata, false); }