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

Function extent_dalloc_wrapper

BeefRT/JEMalloc/src/extent.c:1027–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025}
1026
1027void
1028extent_dalloc_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
1029 edata_t *edata) {
1030 assert(edata_pai_get(edata) == EXTENT_PAI_PAC);
1031 witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
1032 WITNESS_RANK_CORE, 0);
1033
1034 /* Avoid calling the default extent_dalloc unless have to. */
1035 if (!ehooks_dalloc_will_fail(ehooks)) {
1036 /* Remove guard pages for dalloc / unmap. */
1037 if (edata_guarded_get(edata)) {
1038 assert(ehooks_are_default(ehooks));
1039 san_unguard_pages_two_sided(tsdn, ehooks, edata,
1040 pac->emap);
1041 }
1042 /*
1043 * Deregister first to avoid a race with other allocating
1044 * threads, and reregister if deallocation fails.
1045 */
1046 extent_deregister(tsdn, pac, edata);
1047 if (!extent_dalloc_wrapper_try(tsdn, pac, ehooks, edata)) {
1048 return;
1049 }
1050 extent_reregister(tsdn, pac, edata);
1051 }
1052
1053 /* Try to decommit; purge if that fails. */
1054 bool zeroed;
1055 if (!edata_committed_get(edata)) {
1056 zeroed = true;
1057 } else if (!extent_decommit_wrapper(tsdn, ehooks, edata, 0,
1058 edata_size_get(edata))) {
1059 zeroed = true;
1060 } else if (!ehooks_purge_forced(tsdn, ehooks, edata_base_get(edata),
1061 edata_size_get(edata), 0, edata_size_get(edata))) {
1062 zeroed = true;
1063 } else if (edata_state_get(edata) == extent_state_muzzy ||
1064 !ehooks_purge_lazy(tsdn, ehooks, edata_base_get(edata),
1065 edata_size_get(edata), 0, edata_size_get(edata))) {
1066 zeroed = false;
1067 } else {
1068 zeroed = false;
1069 }
1070 edata_zeroed_set(edata, zeroed);
1071
1072 if (config_prof) {
1073 extent_gdump_sub(tsdn, edata);
1074 }
1075
1076 extent_record(tsdn, pac, ehooks, &pac->ecache_retained, edata);
1077}
1078
1079void
1080extent_destroy_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,

Callers 4

extent_maximally_purgeFunction · 0.85
extent_dalloc_gapFunction · 0.85
pac_expand_implFunction · 0.85
pac_decay_stashedFunction · 0.85

Calls 15

edata_pai_getFunction · 0.85
ehooks_dalloc_will_failFunction · 0.85
edata_guarded_getFunction · 0.85
ehooks_are_defaultFunction · 0.85
extent_deregisterFunction · 0.85
extent_reregisterFunction · 0.85
edata_committed_getFunction · 0.85
extent_decommit_wrapperFunction · 0.85
edata_size_getFunction · 0.85

Tested by

no test coverage detected