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:
Piotr Balcer
2021-08-23 14:03:35 +02:00
committed by Qi Wang
parent a9031a0970
commit 7bb05e04be
17 changed files with 165 additions and 41 deletions

View File

@@ -12,7 +12,8 @@ TEST_BEGIN(test_rtree_read_empty) {
tsdn = tsdn_fetch();
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks);
base_t *base = base_new(tsdn, 0,
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
expect_ptr_not_null(base, "Unexpected base_new failure");
rtree_t *rtree = &test_rtree;
@@ -52,7 +53,8 @@ TEST_BEGIN(test_rtree_extrema) {
tsdn_t *tsdn = tsdn_fetch();
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks);
base_t *base = base_new(tsdn, 0,
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
expect_ptr_not_null(base, "Unexpected base_new failure");
rtree_t *rtree = &test_rtree;
@@ -103,7 +105,8 @@ TEST_END
TEST_BEGIN(test_rtree_bits) {
tsdn_t *tsdn = tsdn_fetch();
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks);
base_t *base = base_new(tsdn, 0,
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
expect_ptr_not_null(base, "Unexpected base_new failure");
uintptr_t keys[] = {PAGE, PAGE + 1,
@@ -152,7 +155,8 @@ TEST_BEGIN(test_rtree_random) {
sfmt_t *sfmt = init_gen_rand(SEED);
tsdn_t *tsdn = tsdn_fetch();
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks);
base_t *base = base_new(tsdn, 0,
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
expect_ptr_not_null(base, "Unexpected base_new failure");
uintptr_t keys[NSET];
@@ -250,7 +254,8 @@ test_rtree_range_write(tsdn_t *tsdn, rtree_t *rtree, uintptr_t start,
TEST_BEGIN(test_rtree_range) {
tsdn_t *tsdn = tsdn_fetch();
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks);
base_t *base = base_new(tsdn, 0,
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
expect_ptr_not_null(base, "Unexpected base_new failure");
rtree_t *rtree = &test_rtree;