MCPcopy Create free account
hub / github.com/beefytech/Beef / pac_expand_impl

Function pac_expand_impl

BeefRT/JEMalloc/src/pac.c:190–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190static bool
191pac_expand_impl(tsdn_t *tsdn, pai_t *self, edata_t *edata, size_t old_size,
192 size_t new_size, bool zero, bool *deferred_work_generated) {
193 pac_t *pac = (pac_t *)self;
194 ehooks_t *ehooks = pac_ehooks_get(pac);
195
196 size_t mapped_add = 0;
197 size_t expand_amount = new_size - old_size;
198
199 if (ehooks_merge_will_fail(ehooks)) {
200 return true;
201 }
202 edata_t *trail = ecache_alloc(tsdn, pac, ehooks, &pac->ecache_dirty,
203 edata, expand_amount, PAGE, zero, /* guarded*/ false);
204 if (trail == NULL) {
205 trail = ecache_alloc(tsdn, pac, ehooks, &pac->ecache_muzzy,
206 edata, expand_amount, PAGE, zero, /* guarded*/ false);
207 }
208 if (trail == NULL) {
209 trail = ecache_alloc_grow(tsdn, pac, ehooks,
210 &pac->ecache_retained, edata, expand_amount, PAGE, zero,
211 /* guarded */ false);
212 mapped_add = expand_amount;
213 }
214 if (trail == NULL) {
215 return true;
216 }
217 if (extent_merge_wrapper(tsdn, pac, ehooks, edata, trail)) {
218 extent_dalloc_wrapper(tsdn, pac, ehooks, trail);
219 return true;
220 }
221 if (config_stats && mapped_add > 0) {
222 atomic_fetch_add_zu(&pac->stats->pac_mapped, mapped_add,
223 ATOMIC_RELAXED);
224 }
225 return false;
226}
227
228static bool
229pac_shrink_impl(tsdn_t *tsdn, pai_t *self, edata_t *edata, size_t old_size,

Callers

nothing calls this directly

Calls 6

pac_ehooks_getFunction · 0.85
ehooks_merge_will_failFunction · 0.85
ecache_allocFunction · 0.85
ecache_alloc_growFunction · 0.85
extent_merge_wrapperFunction · 0.85
extent_dalloc_wrapperFunction · 0.85

Tested by

no test coverage detected