| 1025 | } |
| 1026 | |
| 1027 | void |
| 1028 | extent_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 | |
| 1079 | void |
| 1080 | extent_destroy_wrapper(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks, |
no test coverage detected