| 248 | } |
| 249 | |
| 250 | static void |
| 251 | pac_dalloc_impl(tsdn_t *tsdn, pai_t *self, edata_t *edata, |
| 252 | bool *deferred_work_generated) { |
| 253 | pac_t *pac = (pac_t *)self; |
| 254 | ehooks_t *ehooks = pac_ehooks_get(pac); |
| 255 | |
| 256 | if (edata_guarded_get(edata)) { |
| 257 | /* |
| 258 | * Because cached guarded extents do exact fit only, large |
| 259 | * guarded extents are restored on dalloc eagerly (otherwise |
| 260 | * they will not be reused efficiently). Slab sizes have a |
| 261 | * limited number of size classes, and tend to cycle faster. |
| 262 | * |
| 263 | * In the case where coalesce is restrained (VirtualFree on |
| 264 | * Windows), guarded extents are also not cached -- otherwise |
| 265 | * during arena destroy / reset, the retained extents would not |
| 266 | * be whole regions (i.e. they are split between regular and |
| 267 | * guarded). |
| 268 | */ |
| 269 | if (!edata_slab_get(edata) || !maps_coalesce) { |
| 270 | assert(edata_size_get(edata) >= SC_LARGE_MINCLASS || |
| 271 | !maps_coalesce); |
| 272 | san_unguard_pages_two_sided(tsdn, ehooks, edata, |
| 273 | pac->emap); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | ecache_dalloc(tsdn, pac, ehooks, &pac->ecache_dirty, edata); |
| 278 | /* Purging of deallocated pages is deferred */ |
| 279 | *deferred_work_generated = true; |
| 280 | } |
| 281 | |
| 282 | static inline uint64_t |
| 283 | pac_ns_until_purge(tsdn_t *tsdn, decay_t *decay, size_t npages) { |
nothing calls this directly
no test coverage detected