Break extent split dependence on arena.

This commit is contained in:
David Goldblatt 2019-12-13 13:52:34 -08:00 committed by David Goldblatt
parent 0aa9769fb0
commit 56cc56b692
3 changed files with 19 additions and 18 deletions

View File

@ -53,9 +53,9 @@ bool extent_purge_lazy_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
edata_t *edata, size_t offset, size_t length); edata_t *edata, size_t offset, size_t length);
bool extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, bool extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
edata_t *edata, size_t offset, size_t length); edata_t *edata, size_t offset, size_t length);
edata_t *extent_split_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, edata_t *extent_split_wrapper(tsdn_t *tsdn, edata_cache_t *edata_cache,
edata_t *edata, size_t size_a, szind_t szind_a, bool slab_a, ehooks_t *ehooks, edata_t *edata, size_t size_a, szind_t szind_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 extent_merge_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, bool extent_merge_wrapper(tsdn_t *tsdn, ehooks_t *ehooks,
edata_cache_t *edata_cache, edata_t *a, edata_t *b); edata_cache_t *edata_cache, edata_t *a, edata_t *b);

View File

@ -26,7 +26,7 @@ static bool extent_purge_lazy_impl(tsdn_t *tsdn, arena_t *arena,
static bool extent_purge_forced_impl(tsdn_t *tsdn, arena_t *arena, static bool extent_purge_forced_impl(tsdn_t *tsdn, arena_t *arena,
ehooks_t *ehooks, edata_t *edata, size_t offset, size_t length, ehooks_t *ehooks, edata_t *edata, size_t offset, size_t length,
bool growing_retained); bool growing_retained);
static edata_t *extent_split_impl(tsdn_t *tsdn, arena_t *arena, static edata_t *extent_split_impl(tsdn_t *tsdn, edata_cache_t *edata_cache,
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);
@ -659,9 +659,9 @@ extent_split_interior(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
/* Split the lead. */ /* Split the lead. */
if (leadsize != 0) { if (leadsize != 0) {
*lead = *edata; *lead = *edata;
*edata = extent_split_impl(tsdn, arena, ehooks, *lead, *edata = extent_split_impl(tsdn, &arena->edata_cache, ehooks,
leadsize, SC_NSIZES, false, esize + trailsize, szind, slab, *lead, leadsize, SC_NSIZES, false, esize + trailsize, szind,
growing_retained); slab, growing_retained);
if (*edata == NULL) { if (*edata == NULL) {
*to_leak = *lead; *to_leak = *lead;
*lead = NULL; *lead = NULL;
@ -671,8 +671,9 @@ extent_split_interior(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
/* Split the trail. */ /* Split the trail. */
if (trailsize != 0) { if (trailsize != 0) {
*trail = extent_split_impl(tsdn, arena, ehooks, *edata, esize, *trail = extent_split_impl(tsdn, &arena->edata_cache, ehooks,
szind, slab, trailsize, SC_NSIZES, false, growing_retained); *edata, esize, szind, slab, trailsize, SC_NSIZES, false,
growing_retained);
if (*trail == NULL) { if (*trail == NULL) {
*to_leak = *edata; *to_leak = *edata;
*to_salvage = *lead; *to_salvage = *lead;
@ -1410,7 +1411,7 @@ extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
* and returns the trail (except in case of error). * and returns the trail (except in case of error).
*/ */
static edata_t * static edata_t *
extent_split_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, extent_split_impl(tsdn_t *tsdn, edata_cache_t *edata_cache, 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, bool growing_retained) { size_t size_b, szind_t szind_b, bool slab_b, bool growing_retained) {
assert(edata_size_get(edata) == size_a + size_b); assert(edata_size_get(edata) == size_a + size_b);
@ -1421,12 +1422,12 @@ extent_split_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
return NULL; return NULL;
} }
edata_t *trail = edata_cache_get(tsdn, &arena->edata_cache); edata_t *trail = edata_cache_get(tsdn, edata_cache);
if (trail == NULL) { if (trail == NULL) {
goto label_error_a; goto label_error_a;
} }
edata_init(trail, arena_ind_get(arena), edata_init(trail, ehooks_ind_get(ehooks),
(void *)((uintptr_t)edata_base_get(edata) + size_a), size_b, (void *)((uintptr_t)edata_base_get(edata) + size_a), size_b,
slab_b, szind_b, edata_sn_get(edata), edata_state_get(edata), slab_b, szind_b, edata_sn_get(edata), edata_state_get(edata),
edata_zeroed_get(edata), edata_committed_get(edata), edata_zeroed_get(edata), edata_committed_get(edata),
@ -1438,7 +1439,7 @@ extent_split_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
{ {
edata_t lead; edata_t lead;
edata_init(&lead, arena_ind_get(arena), edata_init(&lead, ehooks_ind_get(ehooks),
edata_addr_get(edata), size_a, edata_addr_get(edata), size_a,
slab_a, szind_a, edata_sn_get(edata), slab_a, szind_a, edata_sn_get(edata),
edata_state_get(edata), edata_zeroed_get(edata), edata_state_get(edata), edata_zeroed_get(edata),
@ -1480,17 +1481,17 @@ extent_split_impl(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
label_error_c: label_error_c:
extent_unlock_edata2(tsdn, edata, trail); extent_unlock_edata2(tsdn, edata, trail);
label_error_b: label_error_b:
edata_cache_put(tsdn, &arena->edata_cache, trail); edata_cache_put(tsdn, edata_cache, trail);
label_error_a: label_error_a:
return NULL; return NULL;
} }
edata_t * edata_t *
extent_split_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, extent_split_wrapper(tsdn_t *tsdn, edata_cache_t *edata_cache, 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) {
return extent_split_impl(tsdn, arena, ehooks, edata, size_a, szind_a, return extent_split_impl(tsdn, edata_cache, ehooks, edata, size_a,
slab_a, size_b, szind_b, slab_b, false); szind_a, slab_a, size_b, szind_b, slab_b, false);
} }
static bool static bool

View File

@ -104,7 +104,7 @@ large_ralloc_no_move_shrink(tsdn_t *tsdn, edata_t *edata, size_t usize) {
/* Split excess pages. */ /* Split excess pages. */
if (diff != 0) { if (diff != 0) {
edata_t *trail = extent_split_wrapper(tsdn, arena, edata_t *trail = extent_split_wrapper(tsdn, &arena->edata_cache,
ehooks, edata, usize + sz_large_pad, sz_size2index(usize), ehooks, edata, usize + sz_large_pad, sz_size2index(usize),
false, diff, SC_NSIZES, false); false, diff, SC_NSIZES, false);
if (trail == NULL) { if (trail == NULL) {