mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-04 11:14:20 +03:00
add experimental.arenas_create_ext mallctl
This mallctl accepts an arena_config_t structure which can be used to customize the behavior of the arena. Right now it contains extent_hooks and a new option, metadata_use_hooks, which controls whether the extent hooks are also used for metadata allocation. The medata_use_hooks option has two main use cases: 1. In heterogeneous memory systems, to avoid metadata being placed on potentially slower memory. 2. Avoiding virtual memory from being leaked as a result of metadata allocation failure originating in an extent hook.
This commit is contained in:
parent
a9031a0970
commit
7bb05e04be
17 changed files with 165 additions and 41 deletions
|
|
@ -384,7 +384,7 @@ narenas_total_get(void) {
|
|||
|
||||
/* Create a new arena and insert it into the arenas array at index ind. */
|
||||
static arena_t *
|
||||
arena_init_locked(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
|
||||
arena_init_locked(tsdn_t *tsdn, unsigned ind, const arena_config_t *config) {
|
||||
arena_t *arena;
|
||||
|
||||
assert(ind <= narenas_total_get());
|
||||
|
|
@ -406,7 +406,7 @@ arena_init_locked(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
|
|||
}
|
||||
|
||||
/* Actually initialize the arena. */
|
||||
arena = arena_new(tsdn, ind, extent_hooks);
|
||||
arena = arena_new(tsdn, ind, config);
|
||||
|
||||
return arena;
|
||||
}
|
||||
|
|
@ -430,11 +430,11 @@ arena_new_create_background_thread(tsdn_t *tsdn, unsigned ind) {
|
|||
}
|
||||
|
||||
arena_t *
|
||||
arena_init(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
|
||||
arena_init(tsdn_t *tsdn, unsigned ind, const arena_config_t *config) {
|
||||
arena_t *arena;
|
||||
|
||||
malloc_mutex_lock(tsdn, &arenas_lock);
|
||||
arena = arena_init_locked(tsdn, ind, extent_hooks);
|
||||
arena = arena_init_locked(tsdn, ind, config);
|
||||
malloc_mutex_unlock(tsdn, &arenas_lock);
|
||||
|
||||
arena_new_create_background_thread(tsdn, ind);
|
||||
|
|
@ -570,8 +570,7 @@ arena_choose_hard(tsd_t *tsd, bool internal) {
|
|||
choose[j] = first_null;
|
||||
arena = arena_init_locked(tsd_tsdn(tsd),
|
||||
choose[j],
|
||||
(extent_hooks_t *)
|
||||
&ehooks_default_extent_hooks);
|
||||
&arena_config_default);
|
||||
if (arena == NULL) {
|
||||
malloc_mutex_unlock(tsd_tsdn(tsd),
|
||||
&arenas_lock);
|
||||
|
|
@ -1779,8 +1778,7 @@ malloc_init_hard_a0_locked() {
|
|||
* Initialize one arena here. The rest are lazily created in
|
||||
* arena_choose_hard().
|
||||
*/
|
||||
if (arena_init(TSDN_NULL, 0,
|
||||
(extent_hooks_t *)&ehooks_default_extent_hooks) == NULL) {
|
||||
if (arena_init(TSDN_NULL, 0, &arena_config_default) == NULL) {
|
||||
return true;
|
||||
}
|
||||
a0 = arena_get(TSDN_NULL, 0, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue