diff --git a/include/jemalloc/internal/emap.h b/include/jemalloc/internal/emap.h index b9f6bc06..8c7713ce 100644 --- a/include/jemalloc/internal/emap.h +++ b/include/jemalloc/internal/emap.h @@ -87,12 +87,10 @@ struct emap_prepare_s { }; /** - * These functions do some of the metadata management for merging, splitting, - * and reusing extents. In particular, they set the boundary mappings from - * addresses to edatas and fill in the szind, size, and slab values for the - * output edata (and, for splitting, *all* values for the trail). If the result - * is going to be used as a slab, you still need to call emap_register_interior - * on it, though. + * These functions the emap metadata management for merging, splitting, and + * reusing extents. In particular, they set the boundary mappings from + * addresses to edatas. If the result is going to be used as a slab, you + * still need to call emap_register_interior on it, though. * * Remap simply changes the szind and slab status of an extent's boundary * mappings. If the extent is not a slab, it doesn't bother with updating the @@ -107,9 +105,8 @@ struct emap_prepare_s { * and it returns true on failure (at which point the caller shouldn't commit). * * In all cases, "lead" refers to the lower-addressed extent, and trail to the - * higher-addressed one. Trail can contain garbage (except for its arena_ind - * and esn values) data for the split variants, and can be reused for any - * purpose by its given arena after a merge or a failed split. + * higher-addressed one. It's the caller's responsibility to set the edata + * state appropriately. */ void emap_remap(tsdn_t *tsdn, emap_t *emap, edata_t *edata, szind_t szind, bool slab); diff --git a/src/emap.c b/src/emap.c index 95ff7b34..c79dafa7 100644 --- a/src/emap.c +++ b/src/emap.c @@ -228,7 +228,6 @@ void emap_remap(tsdn_t *tsdn, emap_t *emap, edata_t *edata, szind_t szind, szind, slab); } } - } bool @@ -236,16 +235,6 @@ emap_split_prepare(tsdn_t *tsdn, emap_t *emap, emap_prepare_t *prepare, edata_t *edata, size_t size_a, szind_t szind_a, bool slab_a, edata_t *trail, size_t size_b, szind_t szind_b, bool slab_b) { EMAP_DECLARE_RTREE_CTX; - /* - * Note that while the trail mostly inherits its attributes from the - * extent to be split, it maintains its own arena ind -- this allows - * cross-arena edata interactions, such as occur in the range ecache. - */ - edata_init(trail, edata_arena_ind_get(trail), - (void *)((uintptr_t)edata_base_get(edata) + size_a), size_b, - slab_b, szind_b, edata_sn_get(edata), edata_state_get(edata), - edata_zeroed_get(edata), edata_committed_get(edata), - edata_ranged_get(edata), EXTENT_NOT_HEAD); /* * We use incorrect constants for things like arena ind, zero, ranged, diff --git a/src/extent.c b/src/extent.c index b0db91dc..33179939 100644 --- a/src/extent.c +++ b/src/extent.c @@ -1213,6 +1213,11 @@ extent_split_impl(tsdn_t *tsdn, edata_cache_t *edata_cache, ehooks_t *ehooks, goto label_error_a; } + edata_init(trail, edata_arena_ind_get(edata), + (void *)((uintptr_t)edata_base_get(edata) + size_a), size_b, + slab_b, szind_b, edata_sn_get(edata), edata_state_get(edata), + edata_zeroed_get(edata), edata_committed_get(edata), + edata_ranged_get(edata), EXTENT_NOT_HEAD); emap_prepare_t prepare; bool err = emap_split_prepare(tsdn, &emap_global, &prepare, edata, size_a, szind_a, slab_a, trail, size_b, szind_b, slab_b);