PA: Have expand take szind and slab.

This isn't really necessary, but having a uniform API will help us later.
This commit is contained in:
David Goldblatt 2020-03-10 17:21:04 -07:00 committed by David Goldblatt
parent 0880c2ab97
commit 5bcc2c2ab9
3 changed files with 7 additions and 6 deletions

View File

@ -122,7 +122,8 @@ size_t pa_shard_extent_sn_next(pa_shard_t *shard);
edata_t *pa_alloc(tsdn_t *tsdn, pa_shard_t *shard, size_t size,
size_t alignment, bool slab, szind_t szind, bool *zero, size_t *mapped_add);
/* Returns true on error, in which case nothing changed. */
bool pa_expand(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata,
size_t new_usize, bool *zero, size_t *mapped_add);
bool
pa_expand(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata, size_t new_usize,
szind_t szind, bool slab, bool *zero, size_t *mapped_add);
#endif /* JEMALLOC_INTERNAL_PA_H */

View File

@ -115,8 +115,9 @@ large_ralloc_no_move_expand(tsdn_t *tsdn, edata_t *edata, size_t usize,
*/
bool is_zeroed_trail = zero;
size_t mapped_add;
szind_t szind = sz_size2index(usize);
bool err = pa_expand(tsdn, &arena->pa_shard, edata, usize,
&is_zeroed_trail, &mapped_add);
szind, /* slab */ false, &is_zeroed_trail, &mapped_add);
if (err) {
return true;
}

View File

@ -97,7 +97,7 @@ pa_alloc(tsdn_t *tsdn, pa_shard_t *shard, size_t size, size_t alignment,
bool
pa_expand(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata, size_t new_usize,
bool *zero, size_t *mapped_add) {
szind_t szind, bool slab, bool *zero, size_t *mapped_add) {
ehooks_t *ehooks = pa_shard_ehooks_get(shard);
size_t old_usize = edata_usize_get(edata);
size_t trail_size = new_usize - old_usize;
@ -130,7 +130,6 @@ pa_expand(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata, size_t new_usize,
*mapped_add = 0;
return true;
}
szind_t szind = sz_size2index(new_usize);
emap_remap(tsdn, &emap_global, edata, szind, /* slab */ false);
emap_remap(tsdn, &emap_global, edata, szind, slab);
return false;
}