Avoid setting zero and commit if split fails in extent_recycle.
This commit is contained in:
parent
3e64dae802
commit
e475d03752
24
src/extent.c
24
src/extent.c
@ -791,7 +791,7 @@ static extent_t *
|
|||||||
extent_recycle_extract(tsdn_t *tsdn, arena_t *arena,
|
extent_recycle_extract(tsdn_t *tsdn, arena_t *arena,
|
||||||
extent_hooks_t **r_extent_hooks, rtree_ctx_t *rtree_ctx, extents_t *extents,
|
extent_hooks_t **r_extent_hooks, rtree_ctx_t *rtree_ctx, extents_t *extents,
|
||||||
void *new_addr, size_t size, size_t pad, size_t alignment, bool slab,
|
void *new_addr, size_t size, size_t pad, size_t alignment, bool slab,
|
||||||
bool *zero, bool *commit, bool growing_retained) {
|
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(alignment > 0);
|
assert(alignment > 0);
|
||||||
@ -849,13 +849,6 @@ extent_recycle_extract(tsdn_t *tsdn, arena_t *arena,
|
|||||||
extent_activate_locked(tsdn, arena, extents, extent, false);
|
extent_activate_locked(tsdn, arena, extents, extent, false);
|
||||||
malloc_mutex_unlock(tsdn, &extents->mtx);
|
malloc_mutex_unlock(tsdn, &extents->mtx);
|
||||||
|
|
||||||
if (extent_zeroed_get(extent)) {
|
|
||||||
*zero = true;
|
|
||||||
}
|
|
||||||
if (extent_committed_get(extent)) {
|
|
||||||
*commit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return extent;
|
return extent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,16 +1014,12 @@ extent_recycle(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
|
|||||||
rtree_ctx_t rtree_ctx_fallback;
|
rtree_ctx_t rtree_ctx_fallback;
|
||||||
rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback);
|
rtree_ctx_t *rtree_ctx = tsdn_rtree_ctx(tsdn, &rtree_ctx_fallback);
|
||||||
|
|
||||||
bool committed = false;
|
|
||||||
extent_t *extent = extent_recycle_extract(tsdn, arena, r_extent_hooks,
|
extent_t *extent = extent_recycle_extract(tsdn, arena, r_extent_hooks,
|
||||||
rtree_ctx, extents, new_addr, size, pad, alignment, slab, zero,
|
rtree_ctx, extents, new_addr, size, pad, alignment, slab,
|
||||||
&committed, growing_retained);
|
growing_retained);
|
||||||
if (extent == NULL) {
|
if (extent == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (committed) {
|
|
||||||
*commit = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
extent = extent_recycle_split(tsdn, arena, r_extent_hooks, rtree_ctx,
|
extent = extent_recycle_split(tsdn, arena, r_extent_hooks, rtree_ctx,
|
||||||
extents, new_addr, size, pad, alignment, slab, szind, extent,
|
extents, new_addr, size, pad, alignment, slab, szind, extent,
|
||||||
@ -1049,6 +1038,13 @@ extent_recycle(tsdn_t *tsdn, arena_t *arena, extent_hooks_t **r_extent_hooks,
|
|||||||
extent_zeroed_set(extent, true);
|
extent_zeroed_set(extent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extent_committed_get(extent)) {
|
||||||
|
*commit = true;
|
||||||
|
}
|
||||||
|
if (extent_zeroed_get(extent)) {
|
||||||
|
*zero = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (pad != 0) {
|
if (pad != 0) {
|
||||||
extent_addr_randomize(tsdn, extent, alignment);
|
extent_addr_randomize(tsdn, extent, alignment);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user