Remove commit parameter to ecache functions.
No caller ever wants uncommitted memory.
This commit is contained in:
parent
b8df719d5c
commit
bd3be8e0b1
@ -23,10 +23,10 @@ extern rtree_t extents_rtree;
|
|||||||
|
|
||||||
edata_t *ecache_alloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
edata_t *ecache_alloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
||||||
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
||||||
bool slab, szind_t szind, bool *zero, bool *commit);
|
bool slab, szind_t szind, bool *zero);
|
||||||
edata_t *ecache_alloc_grow(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
edata_t *ecache_alloc_grow(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
||||||
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
||||||
bool slab, szind_t szind, bool *zero, bool *commit);
|
bool slab, szind_t szind, bool *zero);
|
||||||
void ecache_dalloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
void ecache_dalloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
||||||
ecache_t *ecache, edata_t *edata);
|
ecache_t *ecache, edata_t *edata);
|
||||||
edata_t *ecache_evict(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
edata_t *ecache_evict(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
||||||
|
19
src/arena.c
19
src/arena.c
@ -433,19 +433,17 @@ arena_extent_alloc_large(tsdn_t *tsdn, arena_t *arena, size_t usize,
|
|||||||
|
|
||||||
szind_t szind = sz_size2index(usize);
|
szind_t szind = sz_size2index(usize);
|
||||||
size_t mapped_add;
|
size_t mapped_add;
|
||||||
bool commit = true;
|
|
||||||
edata_t *edata = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_dirty,
|
edata_t *edata = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_dirty,
|
||||||
NULL, usize, sz_large_pad, alignment, false, szind, zero, &commit);
|
NULL, usize, sz_large_pad, alignment, false, szind, zero);
|
||||||
if (edata == NULL && arena_may_have_muzzy(arena)) {
|
if (edata == NULL && arena_may_have_muzzy(arena)) {
|
||||||
edata = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_muzzy,
|
edata = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_muzzy,
|
||||||
NULL, usize, sz_large_pad, alignment, false, szind, zero,
|
NULL, usize, sz_large_pad, alignment, false, szind, zero);
|
||||||
&commit);
|
|
||||||
}
|
}
|
||||||
size_t size = usize + sz_large_pad;
|
size_t size = usize + sz_large_pad;
|
||||||
if (edata == NULL) {
|
if (edata == NULL) {
|
||||||
edata = ecache_alloc_grow(tsdn, arena, ehooks,
|
edata = ecache_alloc_grow(tsdn, arena, ehooks,
|
||||||
&arena->ecache_retained, NULL, usize, sz_large_pad,
|
&arena->ecache_retained, NULL, usize, sz_large_pad,
|
||||||
alignment, false, szind, zero, &commit);
|
alignment, false, szind, zero);
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
/*
|
/*
|
||||||
* edata may be NULL on OOM, but in that case mapped_add
|
* edata may be NULL on OOM, but in that case mapped_add
|
||||||
@ -1203,15 +1201,14 @@ static edata_t *
|
|||||||
arena_slab_alloc_hard(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
arena_slab_alloc_hard(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
||||||
const bin_info_t *bin_info, szind_t szind) {
|
const bin_info_t *bin_info, szind_t szind) {
|
||||||
edata_t *slab;
|
edata_t *slab;
|
||||||
bool zero, commit;
|
bool zero;
|
||||||
|
|
||||||
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
||||||
WITNESS_RANK_CORE, 0);
|
WITNESS_RANK_CORE, 0);
|
||||||
|
|
||||||
zero = false;
|
zero = false;
|
||||||
commit = true;
|
|
||||||
slab = ecache_alloc_grow(tsdn, arena, ehooks, &arena->ecache_retained,
|
slab = ecache_alloc_grow(tsdn, arena, ehooks, &arena->ecache_retained,
|
||||||
NULL, bin_info->slab_size, 0, PAGE, true, szind, &zero, &commit);
|
NULL, bin_info->slab_size, 0, PAGE, true, szind, &zero);
|
||||||
|
|
||||||
if (config_stats && slab != NULL) {
|
if (config_stats && slab != NULL) {
|
||||||
arena_stats_mapped_add(tsdn, &arena->stats,
|
arena_stats_mapped_add(tsdn, &arena->stats,
|
||||||
@ -1230,13 +1227,11 @@ arena_slab_alloc(tsdn_t *tsdn, arena_t *arena, szind_t binind, unsigned binshard
|
|||||||
ehooks_t *ehooks = arena_get_ehooks(arena);
|
ehooks_t *ehooks = arena_get_ehooks(arena);
|
||||||
szind_t szind = sz_size2index(bin_info->reg_size);
|
szind_t szind = sz_size2index(bin_info->reg_size);
|
||||||
bool zero = false;
|
bool zero = false;
|
||||||
bool commit = true;
|
|
||||||
edata_t *slab = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_dirty,
|
edata_t *slab = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_dirty,
|
||||||
NULL, bin_info->slab_size, 0, PAGE, true, binind, &zero, &commit);
|
NULL, bin_info->slab_size, 0, PAGE, true, binind, &zero);
|
||||||
if (slab == NULL && arena_may_have_muzzy(arena)) {
|
if (slab == NULL && arena_may_have_muzzy(arena)) {
|
||||||
slab = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_muzzy,
|
slab = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_muzzy,
|
||||||
NULL, bin_info->slab_size, 0, PAGE, true, binind, &zero,
|
NULL, bin_info->slab_size, 0, PAGE, true, binind, &zero);
|
||||||
&commit);
|
|
||||||
}
|
}
|
||||||
if (slab == NULL) {
|
if (slab == NULL) {
|
||||||
slab = arena_slab_alloc_hard(tsdn, arena, ehooks, bin_info,
|
slab = arena_slab_alloc_hard(tsdn, arena, ehooks, bin_info,
|
||||||
|
12
src/extent.c
12
src/extent.c
@ -186,14 +186,15 @@ extent_try_delayed_coalesce(tsdn_t *tsdn, edata_cache_t *edata_cache,
|
|||||||
edata_t *
|
edata_t *
|
||||||
ecache_alloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, ecache_t *ecache,
|
ecache_alloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, ecache_t *ecache,
|
||||||
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,
|
||||||
szind_t szind, bool *zero, bool *commit) {
|
szind_t szind, bool *zero) {
|
||||||
assert(size + pad != 0);
|
assert(size + pad != 0);
|
||||||
assert(alignment != 0);
|
assert(alignment != 0);
|
||||||
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
||||||
WITNESS_RANK_CORE, 0);
|
WITNESS_RANK_CORE, 0);
|
||||||
|
|
||||||
|
bool commit = true;
|
||||||
edata_t *edata = extent_recycle(tsdn, arena, ehooks, ecache, new_addr,
|
edata_t *edata = extent_recycle(tsdn, arena, ehooks, ecache, new_addr,
|
||||||
size, pad, alignment, slab, szind, zero, commit, false);
|
size, pad, alignment, slab, szind, zero, &commit, false);
|
||||||
assert(edata == NULL || edata_dumpable_get(edata));
|
assert(edata == NULL || edata_dumpable_get(edata));
|
||||||
return edata;
|
return edata;
|
||||||
}
|
}
|
||||||
@ -201,14 +202,15 @@ ecache_alloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks, ecache_t *ecache,
|
|||||||
edata_t *
|
edata_t *
|
||||||
ecache_alloc_grow(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
ecache_alloc_grow(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
||||||
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
||||||
bool slab, szind_t szind, bool *zero, bool *commit) {
|
bool slab, szind_t szind, bool *zero) {
|
||||||
assert(size + pad != 0);
|
assert(size + pad != 0);
|
||||||
assert(alignment != 0);
|
assert(alignment != 0);
|
||||||
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
||||||
WITNESS_RANK_CORE, 0);
|
WITNESS_RANK_CORE, 0);
|
||||||
|
|
||||||
|
bool commit = true;
|
||||||
edata_t *edata = extent_alloc_retained(tsdn, arena, ehooks, new_addr,
|
edata_t *edata = extent_alloc_retained(tsdn, arena, ehooks, new_addr,
|
||||||
size, pad, alignment, slab, szind, zero, commit);
|
size, pad, alignment, slab, szind, zero, &commit);
|
||||||
if (edata == NULL) {
|
if (edata == NULL) {
|
||||||
if (opt_retain && new_addr != NULL) {
|
if (opt_retain && new_addr != NULL) {
|
||||||
/*
|
/*
|
||||||
@ -220,7 +222,7 @@ ecache_alloc_grow(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
edata = extent_alloc_wrapper(tsdn, arena, ehooks,
|
edata = extent_alloc_wrapper(tsdn, arena, ehooks,
|
||||||
new_addr, size, pad, alignment, slab, szind, zero, commit);
|
new_addr, size, pad, alignment, slab, szind, zero, &commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(edata == NULL || edata_dumpable_get(edata));
|
assert(edata == NULL || edata_dumpable_get(edata));
|
||||||
|
@ -147,22 +147,21 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, edata_t *edata, size_t usize,
|
|||||||
* false.
|
* false.
|
||||||
*/
|
*/
|
||||||
bool is_zeroed_trail = zero;
|
bool is_zeroed_trail = zero;
|
||||||
bool commit = true;
|
|
||||||
edata_t *trail;
|
edata_t *trail;
|
||||||
bool new_mapping;
|
bool new_mapping;
|
||||||
if ((trail = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_dirty,
|
if ((trail = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_dirty,
|
||||||
edata_past_get(edata), trailsize, 0, CACHELINE, false, SC_NSIZES,
|
edata_past_get(edata), trailsize, 0, CACHELINE, false, SC_NSIZES,
|
||||||
&is_zeroed_trail, &commit)) != NULL
|
&is_zeroed_trail)) != NULL
|
||||||
|| (trail = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_muzzy,
|
|| (trail = ecache_alloc(tsdn, arena, ehooks, &arena->ecache_muzzy,
|
||||||
edata_past_get(edata), trailsize, 0, CACHELINE, false, SC_NSIZES,
|
edata_past_get(edata), trailsize, 0, CACHELINE, false, SC_NSIZES,
|
||||||
&is_zeroed_trail, &commit)) != NULL) {
|
&is_zeroed_trail)) != NULL) {
|
||||||
if (config_stats) {
|
if (config_stats) {
|
||||||
new_mapping = false;
|
new_mapping = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((trail = ecache_alloc_grow(tsdn, arena, ehooks,
|
if ((trail = ecache_alloc_grow(tsdn, arena, ehooks,
|
||||||
&arena->ecache_retained, edata_past_get(edata), trailsize,
|
&arena->ecache_retained, edata_past_get(edata), trailsize,
|
||||||
0, CACHELINE, false, SC_NSIZES, &is_zeroed_trail, &commit))
|
0, CACHELINE, false, SC_NSIZES, &is_zeroed_trail))
|
||||||
== NULL) {
|
== NULL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user