2019-12-04 10:31:47 +08:00
|
|
|
#include "jemalloc/internal/jemalloc_preamble.h"
|
|
|
|
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
|
|
|
|
|
|
|
#include "jemalloc/internal/assert.h"
|
2020-01-28 05:55:46 +08:00
|
|
|
#include "jemalloc/internal/emap.h"
|
2019-12-04 10:31:47 +08:00
|
|
|
#include "jemalloc/internal/extent_dss.h"
|
|
|
|
#include "jemalloc/internal/extent_mmap.h"
|
|
|
|
#include "jemalloc/internal/ph.h"
|
|
|
|
#include "jemalloc/internal/mutex.h"
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/* Data. */
|
|
|
|
|
|
|
|
size_t opt_lg_extent_max_active_fit = LG_EXTENT_MAX_ACTIVE_FIT_DEFAULT;
|
|
|
|
|
2019-12-14 05:46:25 +08:00
|
|
|
static bool extent_commit_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length, bool growing_retained);
|
2020-03-11 01:37:46 +08:00
|
|
|
static bool extent_purge_lazy_impl(tsdn_t *tsdn, ehooks_t *ehooks,
|
|
|
|
edata_t *edata, size_t offset, size_t length, bool growing_retained);
|
|
|
|
static bool extent_purge_forced_impl(tsdn_t *tsdn, ehooks_t *ehooks,
|
|
|
|
edata_t *edata, size_t offset, size_t length, bool growing_retained);
|
2020-03-15 01:49:34 +08:00
|
|
|
static edata_t *extent_split_impl(tsdn_t *tsdn, pa_shard_t *shard,
|
2020-03-16 09:55:43 +08:00
|
|
|
ehooks_t *ehooks, edata_t *edata, size_t size_a, size_t size_b,
|
2019-12-04 10:31:47 +08:00
|
|
|
bool growing_retained);
|
2020-03-15 01:49:34 +08:00
|
|
|
static bool extent_merge_impl(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 00:53:09 +08:00
|
|
|
edata_t *a, edata_t *b, bool growing_retained);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
/* Used exclusively for gdump triggering. */
|
|
|
|
static atomic_zu_t curpages;
|
|
|
|
static atomic_zu_t highpages;
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/*
|
|
|
|
* Function prototypes for static functions that are referenced prior to
|
|
|
|
* definition.
|
|
|
|
*/
|
|
|
|
|
2020-03-15 01:49:34 +08:00
|
|
|
static void extent_deregister(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata);
|
2020-03-11 01:37:46 +08:00
|
|
|
static edata_t *extent_recycle(tsdn_t *tsdn, pa_shard_t *shard,
|
|
|
|
ehooks_t *ehooks, ecache_t *ecache, void *new_addr, size_t usize,
|
2020-03-16 09:55:43 +08:00
|
|
|
size_t alignment, bool zero, bool *commit, bool growing_retained);
|
2020-03-15 01:49:34 +08:00
|
|
|
static edata_t *extent_try_coalesce(tsdn_t *tsdn, pa_shard_t *shard,
|
2020-03-16 00:53:09 +08:00
|
|
|
ehooks_t *ehooks, ecache_t *ecache, edata_t *edata, bool *coalesced,
|
|
|
|
bool growing_retained);
|
2020-03-11 01:37:46 +08:00
|
|
|
static void extent_record(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2019-12-13 08:25:24 +08:00
|
|
|
ecache_t *ecache, edata_t *edata, bool growing_retained);
|
2020-03-11 01:37:46 +08:00
|
|
|
static edata_t *extent_alloc_retained(tsdn_t *tsdn, pa_shard_t *shard,
|
2020-03-16 09:55:43 +08:00
|
|
|
ehooks_t *ehooks, void *new_addr, size_t size, size_t alignment, bool zero,
|
|
|
|
bool *commit);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2020-06-02 09:01:19 +08:00
|
|
|
size_t
|
|
|
|
extent_sn_next(pac_t *pac) {
|
|
|
|
return atomic_fetch_add_zu(&pac->extent_sn_next, 1, ATOMIC_RELAXED);
|
|
|
|
}
|
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
static bool
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_try_delayed_coalesce(tsdn_t *tsdn, pa_shard_t *shard,
|
2020-03-16 00:53:09 +08:00
|
|
|
ehooks_t *ehooks, ecache_t *ecache, edata_t *edata) {
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_state_set(edata, extent_state_active);
|
2019-12-04 10:31:47 +08:00
|
|
|
bool coalesced;
|
2020-03-16 00:53:09 +08:00
|
|
|
edata = extent_try_coalesce(tsdn, shard, ehooks, ecache,
|
2020-03-15 01:49:34 +08:00
|
|
|
edata, &coalesced, false);
|
2019-12-13 08:44:49 +08:00
|
|
|
edata_state_set(edata, ecache->state);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (!coalesced) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-12-13 08:25:24 +08:00
|
|
|
eset_insert(&ecache->eset, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
ecache_alloc(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t alignment,
|
|
|
|
bool zero) {
|
2020-03-09 01:11:02 +08:00
|
|
|
assert(size != 0);
|
2019-12-04 10:31:47 +08:00
|
|
|
assert(alignment != 0);
|
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2020-01-17 05:28:27 +08:00
|
|
|
bool commit = true;
|
2020-03-11 01:37:46 +08:00
|
|
|
edata_t *edata = extent_recycle(tsdn, shard, ehooks, ecache,
|
2020-03-16 09:55:43 +08:00
|
|
|
new_addr, size, alignment, zero, &commit, false);
|
2020-03-14 03:38:28 +08:00
|
|
|
assert(edata == NULL || !edata_ranged_get(edata));
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2019-12-13 09:30:28 +08:00
|
|
|
edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
ecache_alloc_grow(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t alignment,
|
|
|
|
bool zero) {
|
2020-03-09 01:11:02 +08:00
|
|
|
assert(size != 0);
|
2019-12-13 09:30:28 +08:00
|
|
|
assert(alignment != 0);
|
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2020-01-17 05:28:27 +08:00
|
|
|
bool commit = true;
|
2020-03-11 01:37:46 +08:00
|
|
|
edata_t *edata = extent_alloc_retained(tsdn, shard, ehooks, new_addr,
|
2020-03-16 09:55:43 +08:00
|
|
|
size, alignment, zero, &commit);
|
2019-12-13 09:30:28 +08:00
|
|
|
if (edata == NULL) {
|
|
|
|
if (opt_retain && new_addr != NULL) {
|
|
|
|
/*
|
|
|
|
* When retain is enabled and new_addr is set, we do not
|
|
|
|
* attempt extent_alloc_wrapper which does mmap that is
|
|
|
|
* very unlikely to succeed (unless it happens to be at
|
|
|
|
* the end).
|
|
|
|
*/
|
|
|
|
return NULL;
|
|
|
|
}
|
2020-03-11 01:37:46 +08:00
|
|
|
edata = extent_alloc_wrapper(tsdn, shard, ehooks, new_addr,
|
2020-03-16 09:55:43 +08:00
|
|
|
size, alignment, zero, &commit);
|
2019-12-13 09:30:28 +08:00
|
|
|
}
|
|
|
|
|
2020-03-14 03:38:28 +08:00
|
|
|
assert(edata == NULL || !edata_ranged_get(edata));
|
2019-12-13 09:30:28 +08:00
|
|
|
return edata;
|
|
|
|
}
|
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
void
|
2020-03-11 01:37:46 +08:00
|
|
|
ecache_dalloc(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, edata_t *edata) {
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_base_get(edata) != NULL);
|
|
|
|
assert(edata_size_get(edata) != 0);
|
2020-03-14 03:38:28 +08:00
|
|
|
assert(!edata_ranged_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_addr_set(edata, edata_base_get(edata));
|
|
|
|
edata_zeroed_set(edata, false);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn, shard, ehooks, ecache, edata, false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
ecache_evict(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, size_t npages_min) {
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_lock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the LRU coalesced extent, if any. If coalescing was delayed,
|
|
|
|
* the loop will iterate until the LRU extent is fully coalesced.
|
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
while (true) {
|
|
|
|
/* Get the LRU extent, if any. */
|
2020-06-12 06:15:51 +08:00
|
|
|
edata = edata_list_inactive_first(&ecache->eset.lru);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata == NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_return;
|
|
|
|
}
|
|
|
|
/* Check the eviction limit. */
|
2019-12-13 08:25:24 +08:00
|
|
|
size_t extents_npages = ecache_npages_get(ecache);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (extents_npages <= npages_min) {
|
2019-12-10 06:36:45 +08:00
|
|
|
edata = NULL;
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_return;
|
|
|
|
}
|
2019-12-13 08:25:24 +08:00
|
|
|
eset_remove(&ecache->eset, edata);
|
2019-12-13 08:33:19 +08:00
|
|
|
if (!ecache->delay_coalesce) {
|
2019-12-04 10:31:47 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Try to coalesce. */
|
2020-03-16 00:53:09 +08:00
|
|
|
if (extent_try_delayed_coalesce(tsdn, shard, ehooks, ecache,
|
|
|
|
edata)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* The LRU extent was just coalesced and the result placed in
|
|
|
|
* the LRU at its neighbor's position. Start over.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Either mark the extent active or deregister it to protect against
|
|
|
|
* concurrent operations.
|
|
|
|
*/
|
2019-12-13 08:44:49 +08:00
|
|
|
switch (ecache->state) {
|
2019-12-04 10:31:47 +08:00
|
|
|
case extent_state_active:
|
|
|
|
not_reached();
|
|
|
|
case extent_state_dirty:
|
|
|
|
case extent_state_muzzy:
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_state_set(edata, extent_state_active);
|
2019-12-04 10:31:47 +08:00
|
|
|
break;
|
|
|
|
case extent_state_retained:
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister(tsdn, shard, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
not_reached();
|
|
|
|
}
|
|
|
|
|
|
|
|
label_return:
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This can only happen when we fail to allocate a new extent struct (which
|
|
|
|
* indicates OOM), e.g. when trying to split an existing extent.
|
|
|
|
*/
|
|
|
|
static void
|
2020-03-11 01:37:46 +08:00
|
|
|
extents_abandon_vm(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2019-12-13 08:25:24 +08:00
|
|
|
ecache_t *ecache, edata_t *edata, bool growing_retained) {
|
2019-12-10 06:36:45 +08:00
|
|
|
size_t sz = edata_size_get(edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (config_stats) {
|
2020-06-02 08:42:27 +08:00
|
|
|
atomic_fetch_add_zu(&shard->pac.stats->abandoned_vm, sz,
|
2020-03-09 11:43:41 +08:00
|
|
|
ATOMIC_RELAXED);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Leak extent after making sure its pages have already been purged, so
|
|
|
|
* that this is only a virtual memory leak.
|
|
|
|
*/
|
2019-12-13 08:44:49 +08:00
|
|
|
if (ecache->state == extent_state_dirty) {
|
2020-03-11 01:37:46 +08:00
|
|
|
if (extent_purge_lazy_impl(tsdn, ehooks, edata, 0, sz,
|
2019-12-04 10:31:47 +08:00
|
|
|
growing_retained)) {
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_purge_forced_impl(tsdn, ehooks, edata, 0,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_size_get(edata), growing_retained);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
}
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate_locked(tsdn_t *tsdn, ecache_t *ecache, edata_t *edata) {
|
|
|
|
assert(edata_arena_ind_get(edata) == ecache_ind_get(ecache));
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_state_get(edata) == extent_state_active);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-13 08:44:49 +08:00
|
|
|
edata_state_set(edata, ecache->state);
|
2019-12-13 08:25:24 +08:00
|
|
|
eset_insert(&ecache->eset, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate(tsdn_t *tsdn, ecache_t *ecache, edata_t *edata) {
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_lock(tsdn, &ecache->mtx);
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate_locked(tsdn, ecache, edata);
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_activate_locked(tsdn_t *tsdn, ecache_t *ecache, edata_t *edata) {
|
|
|
|
assert(edata_arena_ind_get(edata) == ecache_ind_get(ecache));
|
2019-12-13 08:44:49 +08:00
|
|
|
assert(edata_state_get(edata) == ecache->state);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-13 08:25:24 +08:00
|
|
|
eset_remove(&ecache->eset, edata);
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_state_set(edata, extent_state_active);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_add(tsdn_t *tsdn, const edata_t *edata) {
|
2019-12-04 10:31:47 +08:00
|
|
|
cassert(config_prof);
|
|
|
|
/* prof_gdump() requirement. */
|
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (opt_prof && edata_state_get(edata) == extent_state_active) {
|
|
|
|
size_t nadd = edata_size_get(edata) >> LG_PAGE;
|
2019-12-04 10:31:47 +08:00
|
|
|
size_t cur = atomic_fetch_add_zu(&curpages, nadd,
|
|
|
|
ATOMIC_RELAXED) + nadd;
|
|
|
|
size_t high = atomic_load_zu(&highpages, ATOMIC_RELAXED);
|
|
|
|
while (cur > high && !atomic_compare_exchange_weak_zu(
|
|
|
|
&highpages, &high, cur, ATOMIC_RELAXED, ATOMIC_RELAXED)) {
|
|
|
|
/*
|
|
|
|
* Don't refresh cur, because it may have decreased
|
|
|
|
* since this thread lost the highpages update race.
|
|
|
|
* Note that high is updated in case of CAS failure.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
if (cur > high && prof_gdump_get_unlocked()) {
|
|
|
|
prof_gdump(tsdn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_sub(tsdn_t *tsdn, const edata_t *edata) {
|
2019-12-04 10:31:47 +08:00
|
|
|
cassert(config_prof);
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (opt_prof && edata_state_get(edata) == extent_state_active) {
|
|
|
|
size_t nsub = edata_size_get(edata) >> LG_PAGE;
|
2019-12-04 10:31:47 +08:00
|
|
|
assert(atomic_load_zu(&curpages, ATOMIC_RELAXED) >= nsub);
|
|
|
|
atomic_fetch_sub_zu(&curpages, nsub, ATOMIC_RELAXED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_register_impl(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata,
|
|
|
|
bool gdump_add) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/*
|
|
|
|
* We need to hold the lock to protect against a concurrent coalesce
|
|
|
|
* operation that sees us in a partial state.
|
|
|
|
*/
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_lock_edata(tsdn, shard->pac.emap, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
if (emap_register_boundary(tsdn, shard->pac.emap, edata, SC_NSIZES,
|
2020-03-16 09:55:43 +08:00
|
|
|
/* slab */ false)) {
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata(tsdn, shard->pac.emap, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata(tsdn, shard->pac.emap, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (config_prof && gdump_add) {
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_add(tsdn, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_register(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata) {
|
|
|
|
return extent_register_impl(tsdn, shard, edata, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_register_no_gdump_add(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata) {
|
|
|
|
return extent_register_impl(tsdn, shard, edata, false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_reregister(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata) {
|
|
|
|
bool err = extent_register(tsdn, shard, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
assert(!err);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Removes all pointers to the given extent from the global rtree.
|
|
|
|
*/
|
|
|
|
static void
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister_impl(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata,
|
|
|
|
bool gdump) {
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_lock_edata(tsdn, shard->pac.emap, edata);
|
|
|
|
emap_deregister_boundary(tsdn, shard->pac.emap, edata);
|
|
|
|
emap_unlock_edata(tsdn, shard->pac.emap, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (config_prof && gdump) {
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_sub(tsdn, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata) {
|
|
|
|
extent_deregister_impl(tsdn, shard, edata, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister_no_gdump_sub(tsdn_t *tsdn, pa_shard_t *shard,
|
|
|
|
edata_t *edata) {
|
|
|
|
extent_deregister_impl(tsdn, shard, edata, false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-12-13 08:25:24 +08:00
|
|
|
* Tries to find and remove an extent from ecache that can be used for the
|
2019-12-04 10:31:47 +08:00
|
|
|
* given allocation request.
|
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_recycle_extract(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t alignment,
|
2020-03-09 01:11:02 +08:00
|
|
|
bool growing_retained) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
|
|
|
assert(alignment > 0);
|
|
|
|
if (config_debug && new_addr != NULL) {
|
|
|
|
/*
|
|
|
|
* Non-NULL new_addr has two use cases:
|
|
|
|
*
|
|
|
|
* 1) Recycle a known-extant extent, e.g. during purging.
|
|
|
|
* 2) Perform in-place expanding reallocation.
|
|
|
|
*
|
|
|
|
* Regardless of use case, new_addr must either refer to a
|
|
|
|
* non-existing extent, or to the base of an extant extent,
|
|
|
|
* since only active slabs support interior lookups (which of
|
|
|
|
* course cannot be recycled).
|
|
|
|
*/
|
|
|
|
assert(PAGE_ADDR2BASE(new_addr) == new_addr);
|
|
|
|
assert(alignment <= PAGE);
|
|
|
|
}
|
|
|
|
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_lock(tsdn, &ecache->mtx);
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
if (new_addr != NULL) {
|
2020-05-30 08:47:04 +08:00
|
|
|
edata = emap_lock_edata_from_addr(tsdn, shard->pac.emap,
|
|
|
|
new_addr, false);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata != NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/*
|
2019-12-10 06:36:45 +08:00
|
|
|
* We might null-out edata to report an error, but we
|
2019-12-04 10:31:47 +08:00
|
|
|
* still need to unlock the associated mutex after.
|
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *unlock_edata = edata;
|
|
|
|
assert(edata_base_get(edata) == new_addr);
|
2020-03-10 01:52:26 +08:00
|
|
|
if (edata_arena_ind_get(edata) != ecache_ind_get(ecache)
|
2020-03-09 01:11:02 +08:00
|
|
|
|| edata_size_get(edata) < size
|
2019-12-13 08:25:24 +08:00
|
|
|
|| edata_state_get(edata)
|
2019-12-13 08:44:49 +08:00
|
|
|
!= ecache->state) {
|
2019-12-10 06:36:45 +08:00
|
|
|
edata = NULL;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata(tsdn, shard->pac.emap, unlock_edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
} else {
|
2020-03-15 01:05:12 +08:00
|
|
|
/*
|
|
|
|
* If split and merge are not allowed (Windows w/o retain), try
|
|
|
|
* exact fit only.
|
|
|
|
*/
|
|
|
|
bool exact_only = (!maps_coalesce && !opt_retain);
|
2020-03-15 00:46:09 +08:00
|
|
|
/*
|
|
|
|
* A large extent might be broken up from its original size to
|
|
|
|
* some small size to satisfy a small request. When that small
|
|
|
|
* request is freed, though, it won't merge back with the larger
|
|
|
|
* extent if delayed coalescing is on. The large extent can
|
|
|
|
* then no longer satify a request for its original size. To
|
|
|
|
* limit this effect, when delayed coalescing is enabled, we
|
|
|
|
* put a cap on how big an extent we can split for a request.
|
|
|
|
*/
|
|
|
|
unsigned lg_max_fit = ecache->delay_coalesce
|
|
|
|
? (unsigned)opt_lg_extent_max_active_fit : SC_PTR_BITS;
|
2020-03-15 01:05:12 +08:00
|
|
|
edata = eset_fit(&ecache->eset, size, alignment, exact_only,
|
|
|
|
lg_max_fit);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata == NULL) {
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_activate_locked(tsdn, ecache, edata);
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Given an allocation request and an extent guaranteed to be able to satisfy
|
2019-12-10 06:36:45 +08:00
|
|
|
* it, this splits off lead and trail extents, leaving edata pointing to an
|
2019-12-04 10:31:47 +08:00
|
|
|
* extent satisfying the allocation.
|
2019-12-13 08:25:24 +08:00
|
|
|
* This function doesn't put lead or trail into any ecache; it's the caller's
|
2019-12-04 10:31:47 +08:00
|
|
|
* job to ensure that they can be reused.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
/*
|
2019-12-10 06:36:45 +08:00
|
|
|
* Split successfully. lead, edata, and trail, are modified to extents
|
2019-12-04 10:31:47 +08:00
|
|
|
* describing the ranges before, in, and after the given allocation.
|
|
|
|
*/
|
|
|
|
extent_split_interior_ok,
|
|
|
|
/*
|
|
|
|
* The extent can't satisfy the given allocation request. None of the
|
2019-12-10 06:36:45 +08:00
|
|
|
* input edata_t *s are touched.
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
|
|
|
extent_split_interior_cant_alloc,
|
|
|
|
/*
|
|
|
|
* In a potentially invalid state. Must leak (if *to_leak is non-NULL),
|
|
|
|
* and salvage what's still salvageable (if *to_salvage is non-NULL).
|
2019-12-10 06:36:45 +08:00
|
|
|
* None of lead, edata, or trail are valid.
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
|
|
|
extent_split_interior_error
|
|
|
|
} extent_split_interior_result_t;
|
|
|
|
|
|
|
|
static extent_split_interior_result_t
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_split_interior(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2019-12-04 10:31:47 +08:00
|
|
|
/* The result of splitting, in case of success. */
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t **edata, edata_t **lead, edata_t **trail,
|
2019-12-04 10:31:47 +08:00
|
|
|
/* The mess to clean up, in case of error. */
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t **to_leak, edata_t **to_salvage,
|
2020-03-16 09:55:43 +08:00
|
|
|
void *new_addr, size_t size, size_t alignment, bool growing_retained) {
|
2019-12-10 06:36:45 +08:00
|
|
|
size_t leadsize = ALIGNMENT_CEILING((uintptr_t)edata_base_get(*edata),
|
|
|
|
PAGE_CEILING(alignment)) - (uintptr_t)edata_base_get(*edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
assert(new_addr == NULL || leadsize == 0);
|
2020-03-09 01:11:02 +08:00
|
|
|
if (edata_size_get(*edata) < leadsize + size) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return extent_split_interior_cant_alloc;
|
|
|
|
}
|
2020-03-09 01:11:02 +08:00
|
|
|
size_t trailsize = edata_size_get(*edata) - leadsize - size;
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
*lead = NULL;
|
|
|
|
*trail = NULL;
|
|
|
|
*to_leak = NULL;
|
|
|
|
*to_salvage = NULL;
|
|
|
|
|
|
|
|
/* Split the lead. */
|
|
|
|
if (leadsize != 0) {
|
2019-12-10 06:36:45 +08:00
|
|
|
*lead = *edata;
|
2020-03-16 00:53:09 +08:00
|
|
|
*edata = extent_split_impl(tsdn, shard, ehooks, *lead, leadsize,
|
2020-03-16 09:55:43 +08:00
|
|
|
size + trailsize, growing_retained);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (*edata == NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
*to_leak = *lead;
|
|
|
|
*lead = NULL;
|
|
|
|
return extent_split_interior_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Split the trail. */
|
|
|
|
if (trailsize != 0) {
|
2020-03-16 00:53:09 +08:00
|
|
|
*trail = extent_split_impl(tsdn, shard, ehooks, *edata, size,
|
2020-03-16 09:55:43 +08:00
|
|
|
trailsize, growing_retained);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (*trail == NULL) {
|
2019-12-10 06:36:45 +08:00
|
|
|
*to_leak = *edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
*to_salvage = *lead;
|
|
|
|
*lead = NULL;
|
2019-12-10 06:36:45 +08:00
|
|
|
*edata = NULL;
|
2019-12-04 10:31:47 +08:00
|
|
|
return extent_split_interior_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return extent_split_interior_ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This fulfills the indicated allocation request out of the given extent (which
|
|
|
|
* the caller should have ensured was big enough). If there's any unused space
|
|
|
|
* before or after the resulting allocation, that space is given its own extent
|
2019-12-13 08:25:24 +08:00
|
|
|
* and put back into ecache.
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_recycle_split(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t alignment,
|
|
|
|
edata_t *edata, bool growing_retained) {
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *lead;
|
|
|
|
edata_t *trail;
|
2020-03-02 01:36:09 +08:00
|
|
|
edata_t *to_leak JEMALLOC_CC_SILENCE_INIT(NULL);
|
|
|
|
edata_t *to_salvage JEMALLOC_CC_SILENCE_INIT(NULL);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
extent_split_interior_result_t result = extent_split_interior(
|
2020-03-11 01:37:46 +08:00
|
|
|
tsdn, shard, ehooks, &edata, &lead, &trail, &to_leak, &to_salvage,
|
2020-03-16 09:55:43 +08:00
|
|
|
new_addr, size, alignment, growing_retained);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (!maps_coalesce && result != extent_split_interior_ok
|
|
|
|
&& !opt_retain) {
|
|
|
|
/*
|
|
|
|
* Split isn't supported (implies Windows w/o retain). Avoid
|
2019-12-13 08:25:24 +08:00
|
|
|
* leaking the extent.
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
|
|
|
assert(to_leak != NULL && lead == NULL && trail == NULL);
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate(tsdn, ecache, to_leak);
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == extent_split_interior_ok) {
|
|
|
|
if (lead != NULL) {
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate(tsdn, ecache, lead);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
if (trail != NULL) {
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate(tsdn, ecache, trail);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* We should have picked an extent that was large enough to
|
|
|
|
* fulfill our allocation request.
|
|
|
|
*/
|
|
|
|
assert(result == extent_split_interior_error);
|
|
|
|
if (to_salvage != NULL) {
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister(tsdn, shard, to_salvage);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
if (to_leak != NULL) {
|
2019-12-10 06:36:45 +08:00
|
|
|
void *leak = edata_base_get(to_leak);
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister_no_gdump_sub(tsdn, shard, to_leak);
|
2020-03-11 01:37:46 +08:00
|
|
|
extents_abandon_vm(tsdn, shard, ehooks, ecache, to_leak,
|
2019-12-04 10:31:47 +08:00
|
|
|
growing_retained);
|
2020-05-30 08:47:04 +08:00
|
|
|
assert(emap_lock_edata_from_addr(tsdn, shard->pac.emap,
|
2020-02-06 05:51:05 +08:00
|
|
|
leak, false) == NULL);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
unreachable();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tries to satisfy the given allocation request by reusing one of the extents
|
2019-12-13 08:25:24 +08:00
|
|
|
* in the given ecache_t.
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_recycle(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t alignment, bool zero,
|
|
|
|
bool *commit, bool growing_retained) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
2020-03-11 01:37:46 +08:00
|
|
|
edata_t *edata = extent_recycle_extract(tsdn, shard, ehooks, ecache,
|
2020-03-16 09:55:43 +08:00
|
|
|
new_addr, size, alignment, growing_retained);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata == NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-03-11 01:37:46 +08:00
|
|
|
edata = extent_recycle_split(tsdn, shard, ehooks, ecache, new_addr,
|
2020-03-16 09:55:43 +08:00
|
|
|
size, alignment, edata, growing_retained);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata == NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (*commit && !edata_committed_get(edata)) {
|
2019-12-14 05:46:25 +08:00
|
|
|
if (extent_commit_impl(tsdn, ehooks, edata, 0,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_size_get(edata), growing_retained)) {
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn, shard, ehooks, ecache, edata,
|
2019-12-04 10:31:47 +08:00
|
|
|
growing_retained);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata_committed_get(edata)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
*commit = true;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_state_get(edata) == extent_state_active);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-03-15 09:19:19 +08:00
|
|
|
if (zero) {
|
2019-12-10 06:36:45 +08:00
|
|
|
void *addr = edata_base_get(edata);
|
|
|
|
if (!edata_zeroed_get(edata)) {
|
|
|
|
size_t size = edata_size_get(edata);
|
2019-12-14 02:44:03 +08:00
|
|
|
ehooks_zero(tsdn, ehooks, addr, size);
|
2019-12-05 09:55:24 +08:00
|
|
|
}
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If virtual memory is retained, create increasingly larger extents from which
|
|
|
|
* to split requested extents in order to limit the total number of disjoint
|
2020-03-11 01:37:46 +08:00
|
|
|
* virtual memory ranges retained by each shard.
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_grow_retained(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
size_t size, size_t alignment, bool zero, bool *commit) {
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_assert_owner(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-03-09 01:11:02 +08:00
|
|
|
size_t alloc_size_min = size + PAGE_CEILING(alignment) - PAGE;
|
2019-12-04 10:31:47 +08:00
|
|
|
/* Beware size_t wrap-around. */
|
2020-03-09 01:11:02 +08:00
|
|
|
if (alloc_size_min < size) {
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_err;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Find the next extent size in the series that would be large enough to
|
|
|
|
* satisfy this request.
|
|
|
|
*/
|
|
|
|
pszind_t egn_skip = 0;
|
2020-06-02 07:01:53 +08:00
|
|
|
size_t alloc_size = sz_pind2sz(shard->pac.ecache_grow.next + egn_skip);
|
2019-12-04 10:31:47 +08:00
|
|
|
while (alloc_size < alloc_size_min) {
|
|
|
|
egn_skip++;
|
2020-06-02 07:01:53 +08:00
|
|
|
if (shard->pac.ecache_grow.next + egn_skip >=
|
2019-12-04 10:31:47 +08:00
|
|
|
sz_psz2ind(SC_LARGE_MAXCLASS)) {
|
|
|
|
/* Outside legal range. */
|
|
|
|
goto label_err;
|
|
|
|
}
|
2020-03-09 04:47:02 +08:00
|
|
|
alloc_size = sz_pind2sz(
|
2020-06-02 07:01:53 +08:00
|
|
|
shard->pac.ecache_grow.next + egn_skip);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_t *edata = edata_cache_get(tsdn, shard->pac.edata_cache);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata == NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_err;
|
|
|
|
}
|
|
|
|
bool zeroed = false;
|
|
|
|
bool committed = false;
|
|
|
|
|
|
|
|
void *ptr = ehooks_alloc(tsdn, ehooks, NULL, alloc_size, PAGE, &zeroed,
|
2019-12-14 02:44:03 +08:00
|
|
|
&committed);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (ptr == NULL) {
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_err;
|
|
|
|
}
|
|
|
|
|
2020-05-30 07:57:31 +08:00
|
|
|
edata_init(edata, ecache_ind_get(&shard->pac.ecache_retained), ptr,
|
2020-06-02 09:01:19 +08:00
|
|
|
alloc_size, false, SC_NSIZES, extent_sn_next(&shard->pac),
|
2020-03-14 03:38:28 +08:00
|
|
|
extent_state_active, zeroed, committed, /* ranged */ false,
|
|
|
|
EXTENT_IS_HEAD);
|
2020-02-06 05:51:05 +08:00
|
|
|
|
2020-03-15 01:49:34 +08:00
|
|
|
if (extent_register_no_gdump_add(tsdn, shard, edata)) {
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_err;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata_committed_get(edata)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
*commit = true;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *lead;
|
|
|
|
edata_t *trail;
|
2020-03-02 01:36:09 +08:00
|
|
|
edata_t *to_leak JEMALLOC_CC_SILENCE_INIT(NULL);
|
|
|
|
edata_t *to_salvage JEMALLOC_CC_SILENCE_INIT(NULL);
|
2020-02-06 05:51:05 +08:00
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
extent_split_interior_result_t result = extent_split_interior(tsdn,
|
2020-03-11 01:37:46 +08:00
|
|
|
shard, ehooks, &edata, &lead, &trail, &to_leak, &to_salvage, NULL,
|
2020-03-16 09:55:43 +08:00
|
|
|
size, alignment, /* growing_retained */ true);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (result == extent_split_interior_ok) {
|
|
|
|
if (lead != NULL) {
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn, shard, ehooks,
|
2020-05-30 07:57:31 +08:00
|
|
|
&shard->pac.ecache_retained, lead, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
if (trail != NULL) {
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn, shard, ehooks,
|
2020-05-30 07:57:31 +08:00
|
|
|
&shard->pac.ecache_retained, trail, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* We should have allocated a sufficiently large extent; the
|
|
|
|
* cant_alloc case should not occur.
|
|
|
|
*/
|
|
|
|
assert(result == extent_split_interior_error);
|
|
|
|
if (to_salvage != NULL) {
|
|
|
|
if (config_prof) {
|
|
|
|
extent_gdump_add(tsdn, to_salvage);
|
|
|
|
}
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn, shard, ehooks,
|
2020-05-30 07:57:31 +08:00
|
|
|
&shard->pac.ecache_retained, to_salvage, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
if (to_leak != NULL) {
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister_no_gdump_sub(tsdn, shard, to_leak);
|
2020-03-11 01:37:46 +08:00
|
|
|
extents_abandon_vm(tsdn, shard, ehooks,
|
2020-05-30 07:57:31 +08:00
|
|
|
&shard->pac.ecache_retained, to_leak, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
goto label_err;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (*commit && !edata_committed_get(edata)) {
|
2019-12-14 05:46:25 +08:00
|
|
|
if (extent_commit_impl(tsdn, ehooks, edata, 0,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_size_get(edata), true)) {
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn, shard, ehooks,
|
2020-05-30 07:57:31 +08:00
|
|
|
&shard->pac.ecache_retained, edata, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_err;
|
|
|
|
}
|
2019-12-05 09:55:24 +08:00
|
|
|
/* A successful commit should return zeroed memory. */
|
|
|
|
if (config_debug) {
|
2019-12-10 06:36:45 +08:00
|
|
|
void *addr = edata_addr_get(edata);
|
2019-12-05 09:55:24 +08:00
|
|
|
size_t *p = (size_t *)(uintptr_t)addr;
|
|
|
|
/* Check the first page only. */
|
|
|
|
for (size_t i = 0; i < PAGE / sizeof(size_t); i++) {
|
|
|
|
assert(p[i] == 0);
|
|
|
|
}
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Increment extent_grow_next if doing so wouldn't exceed the allowed
|
|
|
|
* range.
|
|
|
|
*/
|
2020-06-02 07:01:53 +08:00
|
|
|
if (shard->pac.ecache_grow.next + egn_skip + 1 <=
|
|
|
|
shard->pac.ecache_grow.limit) {
|
|
|
|
shard->pac.ecache_grow.next += egn_skip + 1;
|
2019-12-04 10:31:47 +08:00
|
|
|
} else {
|
2020-06-02 07:01:53 +08:00
|
|
|
shard->pac.ecache_grow.next = shard->pac.ecache_grow.limit;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
/* All opportunities for failure are past. */
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (config_prof) {
|
|
|
|
/* Adjust gdump stats now that extent is final size. */
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_add(tsdn, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
2020-03-15 09:19:19 +08:00
|
|
|
if (zero && !edata_zeroed_get(edata)) {
|
2019-12-10 06:36:45 +08:00
|
|
|
void *addr = edata_base_get(edata);
|
|
|
|
size_t size = edata_size_get(edata);
|
2019-12-14 02:44:03 +08:00
|
|
|
ehooks_zero(tsdn, ehooks, addr, size);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
label_err:
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_alloc_retained(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
void *new_addr, size_t size, size_t alignment, bool zero, bool *commit) {
|
2019-12-04 10:31:47 +08:00
|
|
|
assert(size != 0);
|
|
|
|
assert(alignment != 0);
|
|
|
|
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_lock(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-03-11 01:37:46 +08:00
|
|
|
edata_t *edata = extent_recycle(tsdn, shard, ehooks,
|
2020-05-30 07:57:31 +08:00
|
|
|
&shard->pac.ecache_retained, new_addr, size, alignment, zero,
|
|
|
|
commit, /* growing_retained */ true);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata != NULL) {
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (config_prof) {
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_add(tsdn, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
} else if (opt_retain && new_addr == NULL) {
|
2020-03-11 01:37:46 +08:00
|
|
|
edata = extent_grow_retained(tsdn, shard, ehooks, size,
|
2020-03-16 09:55:43 +08:00
|
|
|
alignment, zero, commit);
|
2019-12-04 10:31:47 +08:00
|
|
|
/* extent_grow_retained() always releases extent_grow_mtx. */
|
|
|
|
} else {
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
2020-06-02 07:01:53 +08:00
|
|
|
malloc_mutex_assert_not_owner(tsdn, &shard->pac.ecache_grow.mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2019-12-13 09:30:28 +08:00
|
|
|
edata_t *
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_alloc_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
void *new_addr, size_t size, size_t alignment, bool zero, bool *commit) {
|
2019-12-13 09:30:28 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_t *edata = edata_cache_get(tsdn, shard->pac.edata_cache);
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata == NULL) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
size_t palignment = ALIGNMENT_CEILING(alignment, PAGE);
|
2020-03-09 01:11:02 +08:00
|
|
|
void *addr = ehooks_alloc(tsdn, ehooks, new_addr, size, palignment,
|
2020-03-15 09:19:19 +08:00
|
|
|
&zero, commit);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (addr == NULL) {
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
2020-05-30 07:57:31 +08:00
|
|
|
edata_init(edata, ecache_ind_get(&shard->pac.ecache_dirty), addr,
|
2020-06-02 09:01:19 +08:00
|
|
|
size, /* slab */ false, SC_NSIZES, extent_sn_next(&shard->pac),
|
2020-03-15 09:19:19 +08:00
|
|
|
extent_state_active, zero, *commit, /* ranged */ false,
|
2020-03-14 03:38:28 +08:00
|
|
|
EXTENT_NOT_HEAD);
|
2020-03-15 01:49:34 +08:00
|
|
|
if (extent_register(tsdn, shard, edata)) {
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2019-12-14 02:52:51 +08:00
|
|
|
extent_can_coalesce(ecache_t *ecache, const edata_t *inner,
|
2019-12-10 06:36:45 +08:00
|
|
|
const edata_t *outer) {
|
2019-12-14 03:33:03 +08:00
|
|
|
assert(edata_arena_ind_get(inner) == ecache_ind_get(ecache));
|
|
|
|
|
2019-12-14 02:52:51 +08:00
|
|
|
if (edata_arena_ind_get(inner) != edata_arena_ind_get(outer)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_state_get(inner) == extent_state_active);
|
2019-12-13 08:44:49 +08:00
|
|
|
if (edata_state_get(outer) != ecache->state) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
if (edata_committed_get(inner) != edata_committed_get(outer)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-16 00:53:09 +08:00
|
|
|
extent_coalesce(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, edata_t *inner, edata_t *outer, bool forward,
|
|
|
|
bool growing_retained) {
|
2019-12-14 02:52:51 +08:00
|
|
|
assert(extent_can_coalesce(ecache, inner, outer));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_activate_locked(tsdn, ecache, outer);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2020-03-16 00:53:09 +08:00
|
|
|
bool err = extent_merge_impl(tsdn, shard, ehooks,
|
2019-12-04 10:31:47 +08:00
|
|
|
forward ? inner : outer, forward ? outer : inner, growing_retained);
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_lock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (err) {
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate_locked(tsdn, ecache, outer);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-16 00:53:09 +08:00
|
|
|
extent_try_coalesce_impl(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, edata_t *edata, bool *coalesced, bool growing_retained,
|
2020-03-15 01:49:34 +08:00
|
|
|
bool inactive_only) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/*
|
|
|
|
* We avoid checking / locking inactive neighbors for large size
|
|
|
|
* classes, since they are eagerly coalesced on deallocation which can
|
|
|
|
* cause lock contention.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Continue attempting to coalesce until failure, to protect against
|
|
|
|
* races with other threads that are thwarted by this one.
|
|
|
|
*/
|
|
|
|
bool again;
|
|
|
|
do {
|
|
|
|
again = false;
|
|
|
|
|
|
|
|
/* Try to coalesce forward. */
|
2020-05-30 08:47:04 +08:00
|
|
|
edata_t *next = emap_lock_edata_from_addr(tsdn, shard->pac.emap,
|
2020-02-06 05:51:05 +08:00
|
|
|
edata_past_get(edata), inactive_only);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (next != NULL) {
|
|
|
|
/*
|
2019-12-13 08:25:24 +08:00
|
|
|
* ecache->mtx only protects against races for
|
|
|
|
* like-state extents, so call extent_can_coalesce()
|
2019-12-04 10:31:47 +08:00
|
|
|
* before releasing next's pool lock.
|
|
|
|
*/
|
2019-12-14 02:52:51 +08:00
|
|
|
bool can_coalesce = extent_can_coalesce(ecache,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata, next);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata(tsdn, shard->pac.emap, next);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-03-15 01:49:34 +08:00
|
|
|
if (can_coalesce && !extent_coalesce(tsdn, shard,
|
2020-03-16 00:53:09 +08:00
|
|
|
ehooks, ecache, edata, next, true,
|
2019-12-14 05:46:25 +08:00
|
|
|
growing_retained)) {
|
2019-12-13 08:33:19 +08:00
|
|
|
if (ecache->delay_coalesce) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/* Do minimal coalescing. */
|
|
|
|
*coalesced = true;
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
again = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to coalesce backward. */
|
2020-05-30 08:47:04 +08:00
|
|
|
edata_t *prev = emap_lock_edata_from_addr(tsdn, shard->pac.emap,
|
2020-02-06 05:51:05 +08:00
|
|
|
edata_before_get(edata), inactive_only);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (prev != NULL) {
|
2019-12-14 02:52:51 +08:00
|
|
|
bool can_coalesce = extent_can_coalesce(ecache, edata,
|
|
|
|
prev);
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata(tsdn, shard->pac.emap, prev);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-03-15 01:49:34 +08:00
|
|
|
if (can_coalesce && !extent_coalesce(tsdn, shard,
|
2020-03-16 00:53:09 +08:00
|
|
|
ehooks, ecache, edata, prev, false,
|
2019-12-14 05:46:25 +08:00
|
|
|
growing_retained)) {
|
2019-12-10 06:36:45 +08:00
|
|
|
edata = prev;
|
2019-12-13 08:33:19 +08:00
|
|
|
if (ecache->delay_coalesce) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/* Do minimal coalescing. */
|
|
|
|
*coalesced = true;
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
again = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (again);
|
|
|
|
|
2019-12-13 08:33:19 +08:00
|
|
|
if (ecache->delay_coalesce) {
|
2019-12-04 10:31:47 +08:00
|
|
|
*coalesced = false;
|
|
|
|
}
|
2019-12-10 06:36:45 +08:00
|
|
|
return edata;
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-16 00:53:09 +08:00
|
|
|
extent_try_coalesce(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, edata_t *edata, bool *coalesced, bool growing_retained) {
|
|
|
|
return extent_try_coalesce_impl(tsdn, shard, ehooks, ecache, edata,
|
|
|
|
coalesced, growing_retained, false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-16 00:53:09 +08:00
|
|
|
extent_try_coalesce_large(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, edata_t *edata, bool *coalesced, bool growing_retained) {
|
|
|
|
return extent_try_coalesce_impl(tsdn, shard, ehooks, ecache, edata,
|
|
|
|
coalesced, growing_retained, true);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2020-03-10 03:14:51 +08:00
|
|
|
/* Purge a single extent to retained / unmapped directly. */
|
|
|
|
static void
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_maximally_purge(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-10 03:14:51 +08:00
|
|
|
edata_t *edata) {
|
|
|
|
size_t extent_size = edata_size_get(edata);
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_dalloc_wrapper(tsdn, shard, ehooks, edata);
|
2020-03-10 03:14:51 +08:00
|
|
|
if (config_stats) {
|
|
|
|
/* Update stats accordingly. */
|
2020-06-02 08:42:27 +08:00
|
|
|
LOCKEDINT_MTX_LOCK(tsdn, *shard->pac.stats_mtx);
|
2020-03-10 03:14:51 +08:00
|
|
|
locked_inc_u64(tsdn,
|
2020-06-02 08:42:27 +08:00
|
|
|
LOCKEDINT_MTX(*shard->pac.stats_mtx),
|
|
|
|
&shard->pac.stats->decay_dirty.nmadvise, 1);
|
2020-03-10 03:14:51 +08:00
|
|
|
locked_inc_u64(tsdn,
|
2020-06-02 08:42:27 +08:00
|
|
|
LOCKEDINT_MTX(*shard->pac.stats_mtx),
|
|
|
|
&shard->pac.stats->decay_dirty.purged,
|
2020-03-10 03:14:51 +08:00
|
|
|
extent_size >> LG_PAGE);
|
2020-06-02 08:42:27 +08:00
|
|
|
LOCKEDINT_MTX_UNLOCK(tsdn, *shard->pac.stats_mtx);
|
|
|
|
atomic_fetch_sub_zu(&shard->pac.stats->pac_mapped, extent_size,
|
2020-03-12 09:37:15 +08:00
|
|
|
ATOMIC_RELAXED);
|
2020-03-10 03:14:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
/*
|
|
|
|
* Does the metadata management portions of putting an unused extent into the
|
2020-03-16 09:55:43 +08:00
|
|
|
* given ecache_t (coalesces and inserts into the eset).
|
2019-12-04 10:31:47 +08:00
|
|
|
*/
|
|
|
|
static void
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_record(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, edata_t *edata, bool growing_retained) {
|
2019-12-13 08:44:49 +08:00
|
|
|
assert((ecache->state != extent_state_dirty &&
|
|
|
|
ecache->state != extent_state_muzzy) ||
|
2019-12-10 06:36:45 +08:00
|
|
|
!edata_zeroed_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_lock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_assert_mapped(tsdn, shard->pac.emap, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-13 08:33:19 +08:00
|
|
|
if (!ecache->delay_coalesce) {
|
2020-03-16 00:53:09 +08:00
|
|
|
edata = extent_try_coalesce(tsdn, shard, ehooks, ecache, edata,
|
|
|
|
NULL, growing_retained);
|
2019-12-10 06:36:45 +08:00
|
|
|
} else if (edata_size_get(edata) >= SC_LARGE_MINCLASS) {
|
2020-05-30 07:57:31 +08:00
|
|
|
assert(ecache == &shard->pac.ecache_dirty);
|
2019-12-13 08:25:24 +08:00
|
|
|
/* Always coalesce large extents eagerly. */
|
2019-12-04 10:31:47 +08:00
|
|
|
bool coalesced;
|
|
|
|
do {
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_state_get(edata) == extent_state_active);
|
2020-03-16 00:53:09 +08:00
|
|
|
edata = extent_try_coalesce_large(tsdn, shard, ehooks,
|
|
|
|
ecache, edata, &coalesced, growing_retained);
|
2019-12-04 10:31:47 +08:00
|
|
|
} while (coalesced);
|
2020-01-14 08:18:32 +08:00
|
|
|
if (edata_size_get(edata) >= oversize_threshold &&
|
2020-03-11 01:37:46 +08:00
|
|
|
pa_shard_may_force_decay(shard)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/* Shortcut to purge the oversize extent eagerly. */
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_maximally_purge(tsdn, shard, ehooks, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2019-12-14 05:34:35 +08:00
|
|
|
extent_deactivate_locked(tsdn, ecache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-13 08:25:24 +08:00
|
|
|
malloc_mutex_unlock(tsdn, &ecache->mtx);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_dalloc_gap(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-10 03:20:06 +08:00
|
|
|
edata_t *edata) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2020-03-15 01:49:34 +08:00
|
|
|
if (extent_register(tsdn, shard, edata)) {
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
return;
|
|
|
|
}
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_dalloc_wrapper(tsdn, shard, ehooks, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_dalloc_wrapper_try(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata) {
|
2019-12-04 10:31:47 +08:00
|
|
|
bool err;
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_base_get(edata) != NULL);
|
|
|
|
assert(edata_size_get(edata) != 0);
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_addr_set(edata, edata_base_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
/* Try to deallocate. */
|
2019-12-10 06:36:45 +08:00
|
|
|
err = ehooks_dalloc(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), edata_committed_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (!err) {
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_dalloc_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata) {
|
2020-03-14 03:38:28 +08:00
|
|
|
assert(!edata_ranged_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
|
|
|
/* Avoid calling the default extent_dalloc unless have to. */
|
2019-12-12 05:35:43 +08:00
|
|
|
if (!ehooks_dalloc_will_fail(ehooks)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
/*
|
|
|
|
* Deregister first to avoid a race with other allocating
|
|
|
|
* threads, and reregister if deallocation fails.
|
|
|
|
*/
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister(tsdn, shard, edata);
|
2020-03-11 01:37:46 +08:00
|
|
|
if (!extent_dalloc_wrapper_try(tsdn, shard, ehooks, edata)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
return;
|
|
|
|
}
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_reregister(tsdn, shard, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to decommit; purge if that fails. */
|
|
|
|
bool zeroed;
|
2019-12-10 06:36:45 +08:00
|
|
|
if (!edata_committed_get(edata)) {
|
2019-12-04 10:31:47 +08:00
|
|
|
zeroed = true;
|
2019-12-14 05:46:25 +08:00
|
|
|
} else if (!extent_decommit_wrapper(tsdn, ehooks, edata, 0,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_size_get(edata))) {
|
2019-12-04 10:31:47 +08:00
|
|
|
zeroed = true;
|
2019-12-10 06:36:45 +08:00
|
|
|
} else if (!ehooks_purge_forced(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), 0, edata_size_get(edata))) {
|
2019-12-04 10:31:47 +08:00
|
|
|
zeroed = true;
|
2019-12-10 06:36:45 +08:00
|
|
|
} else if (edata_state_get(edata) == extent_state_muzzy ||
|
|
|
|
!ehooks_purge_lazy(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), 0, edata_size_get(edata))) {
|
2019-12-04 10:31:47 +08:00
|
|
|
zeroed = false;
|
|
|
|
} else {
|
|
|
|
zeroed = false;
|
|
|
|
}
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_zeroed_set(edata, zeroed);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (config_prof) {
|
2019-12-10 06:36:45 +08:00
|
|
|
extent_gdump_sub(tsdn, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
2020-05-30 07:57:31 +08:00
|
|
|
extent_record(tsdn, shard, ehooks, &shard->pac.ecache_retained, edata,
|
2020-03-11 01:37:46 +08:00
|
|
|
false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_destroy_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata) {
|
|
|
|
assert(edata_base_get(edata) != NULL);
|
|
|
|
assert(edata_size_get(edata) != 0);
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
|
|
|
|
|
|
|
/* Deregister first to avoid a race with other allocating threads. */
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_deregister(tsdn, shard, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_addr_set(edata, edata_base_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
/* Try to destroy; silently fail otherwise. */
|
2019-12-10 06:36:45 +08:00
|
|
|
ehooks_destroy(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), edata_committed_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, edata);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2019-12-14 05:46:25 +08:00
|
|
|
extent_commit_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length, bool growing_retained) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
2019-12-10 06:36:45 +08:00
|
|
|
bool err = ehooks_commit(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), offset, length);
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_committed_set(edata, edata_committed_get(edata) || !err);
|
2019-12-04 10:31:47 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2019-12-14 05:46:25 +08:00
|
|
|
extent_commit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length) {
|
|
|
|
return extent_commit_impl(tsdn, ehooks, edata, offset, length,
|
2019-12-04 10:31:47 +08:00
|
|
|
false);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2019-12-14 05:46:25 +08:00
|
|
|
extent_decommit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, 0);
|
2019-12-10 06:36:45 +08:00
|
|
|
bool err = ehooks_decommit(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), offset, length);
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_committed_set(edata, edata_committed_get(edata) && err);
|
2019-12-04 10:31:47 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_purge_lazy_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length, bool growing_retained) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
2019-12-10 06:36:45 +08:00
|
|
|
bool err = ehooks_purge_lazy(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), offset, length);
|
2019-12-04 10:31:47 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_purge_lazy_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length) {
|
|
|
|
return extent_purge_lazy_impl(tsdn, ehooks, edata, offset,
|
2019-12-04 10:31:47 +08:00
|
|
|
length, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_purge_forced_impl(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length, bool growing_retained) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
2019-12-10 06:36:45 +08:00
|
|
|
bool err = ehooks_purge_forced(tsdn, ehooks, edata_base_get(edata),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(edata), offset, length);
|
2019-12-04 10:31:47 +08:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2020-03-11 01:37:46 +08:00
|
|
|
extent_purge_forced_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length) {
|
|
|
|
return extent_purge_forced_impl(tsdn, ehooks, edata, offset, length,
|
|
|
|
false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Accepts the extent to split, and the characteristics of each side of the
|
|
|
|
* split. The 'a' parameters go with the 'lead' of the resulting pair of
|
|
|
|
* extents (the lower addressed portion of the split), and the 'b' parameters go
|
|
|
|
* with the trail (the higher addressed portion). This makes 'extent' the lead,
|
|
|
|
* and returns the trail (except in case of error).
|
|
|
|
*/
|
2019-12-10 06:36:45 +08:00
|
|
|
static edata_t *
|
2020-03-16 00:53:09 +08:00
|
|
|
extent_split_impl(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 09:55:43 +08:00
|
|
|
edata_t *edata, size_t size_a, size_t size_b, bool growing_retained) {
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_size_get(edata) == size_a + size_b);
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
|
|
|
|
|
|
|
if (ehooks_split_will_fail(ehooks)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_t *trail = edata_cache_get(tsdn, shard->pac.edata_cache);
|
2019-12-04 10:31:47 +08:00
|
|
|
if (trail == NULL) {
|
|
|
|
goto label_error_a;
|
|
|
|
}
|
|
|
|
|
2020-03-14 10:33:30 +08:00
|
|
|
edata_init(trail, edata_arena_ind_get(edata),
|
|
|
|
(void *)((uintptr_t)edata_base_get(edata) + size_a), size_b,
|
2020-03-16 09:55:43 +08:00
|
|
|
/* slab */ false, SC_NSIZES, edata_sn_get(edata),
|
|
|
|
edata_state_get(edata), edata_zeroed_get(edata),
|
|
|
|
edata_committed_get(edata), edata_ranged_get(edata),
|
|
|
|
EXTENT_NOT_HEAD);
|
2020-02-04 06:21:48 +08:00
|
|
|
emap_prepare_t prepare;
|
2020-05-30 08:47:04 +08:00
|
|
|
bool err = emap_split_prepare(tsdn, shard->pac.emap, &prepare, edata,
|
2020-03-17 02:31:38 +08:00
|
|
|
size_a, trail, size_b);
|
2020-02-04 05:27:21 +08:00
|
|
|
if (err) {
|
2019-12-04 10:31:47 +08:00
|
|
|
goto label_error_b;
|
|
|
|
}
|
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_lock_edata2(tsdn, shard->pac.emap, edata, trail);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-02-04 05:27:21 +08:00
|
|
|
err = ehooks_split(tsdn, ehooks, edata_base_get(edata), size_a + size_b,
|
|
|
|
size_a, size_b, edata_committed_get(edata));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (err) {
|
|
|
|
goto label_error_c;
|
|
|
|
}
|
|
|
|
|
2020-03-14 09:45:54 +08:00
|
|
|
edata_size_set(edata, size_a);
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_split_commit(tsdn, shard->pac.emap, &prepare, edata, size_a, trail,
|
2020-03-17 02:31:38 +08:00
|
|
|
size_b);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata2(tsdn, shard->pac.emap, edata, trail);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
return trail;
|
|
|
|
label_error_c:
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_unlock_edata2(tsdn, shard->pac.emap, edata, trail);
|
2019-12-04 10:31:47 +08:00
|
|
|
label_error_b:
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, trail);
|
2019-12-04 10:31:47 +08:00
|
|
|
label_error_a:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_split_wrapper(tsdn_t *tsdn, pa_shard_t *shard,
|
2020-03-16 09:55:43 +08:00
|
|
|
ehooks_t *ehooks, edata_t *edata, size_t size_a, size_t size_b) {
|
|
|
|
return extent_split_impl(tsdn, shard, ehooks, edata, size_a, size_b,
|
|
|
|
/* growing_retained */ false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2020-03-16 00:53:09 +08:00
|
|
|
extent_merge_impl(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks, edata_t *a,
|
|
|
|
edata_t *b, bool growing_retained) {
|
2019-12-04 10:31:47 +08:00
|
|
|
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
|
|
|
|
WITNESS_RANK_CORE, growing_retained ? 1 : 0);
|
2019-12-10 06:36:45 +08:00
|
|
|
assert(edata_base_get(a) < edata_base_get(b));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2019-12-14 03:16:58 +08:00
|
|
|
assert(edata_arena_ind_get(a) == edata_arena_ind_get(b));
|
|
|
|
assert(edata_arena_ind_get(a) == ehooks_ind_get(ehooks));
|
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
bool err = ehooks_merge(tsdn, ehooks, edata_base_get(a),
|
2019-12-12 09:23:24 +08:00
|
|
|
edata_size_get(a), edata_is_head_get(a), edata_base_get(b),
|
2019-12-14 02:44:03 +08:00
|
|
|
edata_size_get(b), edata_is_head_get(b), edata_committed_get(a));
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
if (err) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The rtree writes must happen while all the relevant elements are
|
|
|
|
* owned, so the following code uses decomposed helper functions rather
|
|
|
|
* than extent_{,de}register() to do things in the right order.
|
|
|
|
*/
|
2020-02-04 06:21:48 +08:00
|
|
|
emap_prepare_t prepare;
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_merge_prepare(tsdn, shard->pac.emap, &prepare, a, b);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_lock_edata2(tsdn, shard->pac.emap, a, b);
|
2020-03-14 09:45:54 +08:00
|
|
|
|
|
|
|
edata_size_set(a, edata_size_get(a) + edata_size_get(b));
|
|
|
|
edata_sn_set(a, (edata_sn_get(a) < edata_sn_get(b)) ?
|
|
|
|
edata_sn_get(a) : edata_sn_get(b));
|
|
|
|
edata_zeroed_set(a, edata_zeroed_get(a) && edata_zeroed_get(b));
|
|
|
|
|
2020-05-30 08:47:04 +08:00
|
|
|
emap_merge_commit(tsdn, shard->pac.emap, &prepare, a, b);
|
|
|
|
emap_unlock_edata2(tsdn, shard->pac.emap, a, b);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
2020-05-30 08:14:16 +08:00
|
|
|
edata_cache_put(tsdn, shard->pac.edata_cache, b);
|
2019-12-04 10:31:47 +08:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2020-03-15 01:49:34 +08:00
|
|
|
extent_merge_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
2020-03-16 00:53:09 +08:00
|
|
|
edata_t *a, edata_t *b) {
|
|
|
|
return extent_merge_impl(tsdn, shard, ehooks, a, b, false);
|
2019-12-04 10:31:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
extent_boot(void) {
|
2019-12-19 05:38:14 +08:00
|
|
|
assert(sizeof(slab_data_t) >= sizeof(e_prof_info_t));
|
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
if (have_dss) {
|
|
|
|
extent_dss_boot();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|