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

Function pac_decay_stashed

BeefRT/JEMalloc/src/pac.c:362–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362static size_t
363pac_decay_stashed(tsdn_t *tsdn, pac_t *pac, decay_t *decay,
364 pac_decay_stats_t *decay_stats, ecache_t *ecache, bool fully_decay,
365 edata_list_inactive_t *decay_extents) {
366 bool err;
367
368 size_t nmadvise = 0;
369 size_t nunmapped = 0;
370 size_t npurged = 0;
371
372 ehooks_t *ehooks = pac_ehooks_get(pac);
373
374 bool try_muzzy = !fully_decay
375 && pac_decay_ms_get(pac, extent_state_muzzy) != 0;
376
377 for (edata_t *edata = edata_list_inactive_first(decay_extents); edata !=
378 NULL; edata = edata_list_inactive_first(decay_extents)) {
379 edata_list_inactive_remove(decay_extents, edata);
380
381 size_t size = edata_size_get(edata);
382 size_t npages = size >> LG_PAGE;
383
384 nmadvise++;
385 npurged += npages;
386
387 switch (ecache->state) {
388 case extent_state_active:
389 not_reached();
390 case extent_state_dirty:
391 if (try_muzzy) {
392 err = extent_purge_lazy_wrapper(tsdn, ehooks,
393 edata, /* offset */ 0, size);
394 if (!err) {
395 ecache_dalloc(tsdn, pac, ehooks,
396 &pac->ecache_muzzy, edata);
397 break;
398 }
399 }
400 JEMALLOC_FALLTHROUGH;
401 case extent_state_muzzy:
402 extent_dalloc_wrapper(tsdn, pac, ehooks, edata);
403 nunmapped += npages;
404 break;
405 case extent_state_retained:
406 default:
407 not_reached();
408 }
409 }
410
411 if (config_stats) {
412 LOCKEDINT_MTX_LOCK(tsdn, *pac->stats_mtx);
413 locked_inc_u64(tsdn, LOCKEDINT_MTX(*pac->stats_mtx),
414 &decay_stats->npurge, 1);
415 locked_inc_u64(tsdn, LOCKEDINT_MTX(*pac->stats_mtx),
416 &decay_stats->nmadvise, nmadvise);
417 locked_inc_u64(tsdn, LOCKEDINT_MTX(*pac->stats_mtx),
418 &decay_stats->purged, npurged);
419 LOCKEDINT_MTX_UNLOCK(tsdn, *pac->stats_mtx);

Callers 1

pac_decay_to_limitFunction · 0.85

Calls 7

pac_ehooks_getFunction · 0.85
pac_decay_ms_getFunction · 0.85
edata_size_getFunction · 0.85
ecache_dallocFunction · 0.85
extent_dalloc_wrapperFunction · 0.85
locked_inc_u64Function · 0.85

Tested by

no test coverage detected