Remove merge dependence on the arena.

This commit is contained in:
David Goldblatt 2019-12-13 11:16:58 -08:00 committed by David Goldblatt
parent 439219be7e
commit 372042a082
3 changed files with 15 additions and 16 deletions

View File

@ -56,8 +56,8 @@ bool extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
edata_t *extent_split_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, edata_t *extent_split_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
edata_t *edata, size_t size_a, szind_t szind_a, bool slab_a, edata_t *edata, size_t size_a, szind_t szind_a, bool slab_a,
size_t size_b, szind_t szind_b, bool slab_b); size_t size_b, szind_t szind_b, bool slab_b);
bool extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, bool extent_merge_wrapper(tsdn_t *tsdn, ehooks_t *ehooks,
edata_t *a, edata_t *b); edata_cache_t *edata_cache, edata_t *a, edata_t *b);
bool extent_boot(void); bool extent_boot(void);

View File

@ -30,8 +30,8 @@ static edata_t *extent_split_impl(tsdn_t *tsdn, arena_t *arena,
ehooks_t *ehooks, edata_t *edata, size_t size_a, szind_t szind_a, ehooks_t *ehooks, edata_t *edata, size_t size_a, szind_t szind_a,
bool slab_a, size_t size_b, szind_t szind_b, bool slab_b, bool slab_a, size_t size_b, szind_t szind_b, bool slab_b,
bool growing_retained); bool growing_retained);
static bool extent_merge_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, static bool extent_merge_impl(tsdn_t *tsdn, ehooks_t *ehooks,
edata_t *a, edata_t *b, bool growing_retained); edata_cache_t *edata_cache, edata_t *a, edata_t *b, bool growing_retained);
/* Used exclusively for gdump triggering. */ /* Used exclusively for gdump triggering. */
static atomic_zu_t curpages; static atomic_zu_t curpages;
@ -1087,7 +1087,7 @@ extent_coalesce(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
extent_activate_locked(tsdn, arena, ecache, outer); extent_activate_locked(tsdn, arena, ecache, outer);
malloc_mutex_unlock(tsdn, &ecache->mtx); malloc_mutex_unlock(tsdn, &ecache->mtx);
bool err = extent_merge_impl(tsdn, arena, ehooks, bool err = extent_merge_impl(tsdn, ehooks, &arena->edata_cache,
forward ? inner : outer, forward ? outer : inner, growing_retained); forward ? inner : outer, forward ? outer : inner, growing_retained);
malloc_mutex_lock(tsdn, &ecache->mtx); malloc_mutex_lock(tsdn, &ecache->mtx);
@ -1495,12 +1495,15 @@ extent_split_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
} }
static bool static bool
extent_merge_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, edata_t *a, extent_merge_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_cache_t *edata_cache,
edata_t *b, bool growing_retained) { edata_t *a, edata_t *b, bool growing_retained) {
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn), witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
WITNESS_RANK_CORE, growing_retained ? 1 : 0); WITNESS_RANK_CORE, growing_retained ? 1 : 0);
assert(edata_base_get(a) < edata_base_get(b)); assert(edata_base_get(a) < edata_base_get(b));
assert(edata_arena_ind_get(a) == edata_arena_ind_get(b));
assert(edata_arena_ind_get(a) == ehooks_ind_get(ehooks));
bool err = ehooks_merge(tsdn, ehooks, edata_base_get(a), bool err = ehooks_merge(tsdn, ehooks, edata_base_get(a),
edata_size_get(a), edata_is_head_get(a), edata_base_get(b), edata_size_get(a), edata_is_head_get(a), edata_base_get(b),
edata_size_get(b), edata_is_head_get(b), edata_committed_get(a)); edata_size_get(b), edata_is_head_get(b), edata_committed_get(a));
@ -1546,20 +1549,15 @@ extent_merge_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, edata_t *a,
extent_unlock_edata2(tsdn, a, b); extent_unlock_edata2(tsdn, a, b);
/* edata_cache_put(tsdn, edata_cache, b);
* If we got here, we merged the extents; so they must be from the same
* arena (i.e. this one).
*/
assert(edata_arena_ind_get(b) == arena_ind_get(arena));
edata_cache_put(tsdn, &arena->edata_cache, b);
return false; return false;
} }
bool bool
extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, extent_merge_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_cache_t *edata_cache,
edata_t *a, edata_t *b) { edata_t *a, edata_t *b) {
return extent_merge_impl(tsdn, arena, ehooks, a, b, false); return extent_merge_impl(tsdn, ehooks, edata_cache, a, b, false);
} }
bool bool

View File

@ -170,7 +170,8 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, edata_t *edata, size_t usize,
} }
} }
if (extent_merge_wrapper(tsdn, arena, ehooks, edata, trail)) { if (extent_merge_wrapper(tsdn, ehooks, &arena->edata_cache, edata,
trail)) {
extent_dalloc_wrapper(tsdn, arena, ehooks, trail); extent_dalloc_wrapper(tsdn, arena, ehooks, trail);
return true; return true;
} }