Small refactors around 7bb05e0
.
This commit is contained in:
parent
3c4b717ffc
commit
83f3294027
@ -1,5 +1,5 @@
|
|||||||
#ifndef JEMALLOC_INTERNAL_ARENA_STRUCTS_B_H
|
#ifndef JEMALLOC_INTERNAL_ARENA_STRUCTS_H
|
||||||
#define JEMALLOC_INTERNAL_ARENA_STRUCTS_B_H
|
#define JEMALLOC_INTERNAL_ARENA_STRUCTS_H
|
||||||
|
|
||||||
#include "jemalloc/internal/arena_stats.h"
|
#include "jemalloc/internal/arena_stats.h"
|
||||||
#include "jemalloc/internal/atomic.h"
|
#include "jemalloc/internal/atomic.h"
|
||||||
@ -98,4 +98,4 @@ struct arena_s {
|
|||||||
bin_t bins[0];
|
bin_t bins[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_ARENA_STRUCTS_B_H */
|
#endif /* JEMALLOC_INTERNAL_ARENA_STRUCTS_H */
|
||||||
|
@ -43,7 +43,7 @@ typedef enum {
|
|||||||
|
|
||||||
struct arena_config_s {
|
struct arena_config_s {
|
||||||
/* extent hooks to be used for the arena */
|
/* extent hooks to be used for the arena */
|
||||||
struct extent_hooks_s *extent_hooks;
|
extent_hooks_t *extent_hooks;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use extent hooks for metadata (base) allocations when true.
|
* Use extent hooks for metadata (base) allocations when true.
|
||||||
|
@ -65,8 +65,7 @@ arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing) {
|
|||||||
ret = (arena_t *)atomic_load_p(&arenas[ind], ATOMIC_ACQUIRE);
|
ret = (arena_t *)atomic_load_p(&arenas[ind], ATOMIC_ACQUIRE);
|
||||||
if (unlikely(ret == NULL)) {
|
if (unlikely(ret == NULL)) {
|
||||||
if (init_if_missing) {
|
if (init_if_missing) {
|
||||||
ret = arena_init(tsdn, ind,
|
ret = arena_init(tsdn, ind, &arena_config_default);
|
||||||
&arena_config_default);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -298,7 +298,7 @@ base_block_alloc(tsdn_t *tsdn, base_t *base, ehooks_t *ehooks, unsigned ind,
|
|||||||
static ehooks_t *
|
static ehooks_t *
|
||||||
base_ehooks_get_for_metadata(base_t *base) {
|
base_ehooks_get_for_metadata(base_t *base) {
|
||||||
return base->metadata_use_hooks ? &base->ehooks :
|
return base->metadata_use_hooks ? &base->ehooks :
|
||||||
(struct ehooks_s *)&ehooks_default_extent_hooks;
|
(ehooks_t *)&ehooks_default_extent_hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -522,7 +522,7 @@ base_postfork_child(tsdn_t *tsdn, base_t *base) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
base_boot(tsdn_t *tsdn) {
|
base_boot(tsdn_t *tsdn) {
|
||||||
b0 = base_new(tsdn, 0,
|
b0 = base_new(tsdn, 0, (extent_hooks_t *)&ehooks_default_extent_hooks,
|
||||||
(extent_hooks_t *)&ehooks_default_extent_hooks, true);
|
/* metadata_use_hooks */ true);
|
||||||
return (b0 == NULL);
|
return (b0 == NULL);
|
||||||
}
|
}
|
||||||
|
@ -570,8 +570,7 @@ arena_choose_hard(tsd_t *tsd, bool internal) {
|
|||||||
/* Initialize a new arena. */
|
/* Initialize a new arena. */
|
||||||
choose[j] = first_null;
|
choose[j] = first_null;
|
||||||
arena = arena_init_locked(tsd_tsdn(tsd),
|
arena = arena_init_locked(tsd_tsdn(tsd),
|
||||||
choose[j],
|
choose[j], &arena_config_default);
|
||||||
&arena_config_default);
|
|
||||||
if (arena == NULL) {
|
if (arena == NULL) {
|
||||||
malloc_mutex_unlock(tsd_tsdn(tsd),
|
malloc_mutex_unlock(tsd_tsdn(tsd),
|
||||||
&arenas_lock);
|
&arenas_lock);
|
||||||
|
@ -53,8 +53,8 @@ test_data_t *init_test_data(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
|
|||||||
assert_ptr_not_null(test_data, "");
|
assert_ptr_not_null(test_data, "");
|
||||||
init_test_extent_hooks(&test_data->hooks);
|
init_test_extent_hooks(&test_data->hooks);
|
||||||
|
|
||||||
base_t *base = base_new(TSDN_NULL, /* ind */ 1,
|
base_t *base = base_new(TSDN_NULL, /* ind */ 1, &test_data->hooks,
|
||||||
&test_data->hooks, /* metadata_use_hooks */ true);
|
/* metadata_use_hooks */ true);
|
||||||
assert_ptr_not_null(base, "");
|
assert_ptr_not_null(base, "");
|
||||||
|
|
||||||
test_data->base = base;
|
test_data->base = base;
|
||||||
|
@ -12,8 +12,8 @@ TEST_BEGIN(test_rtree_read_empty) {
|
|||||||
|
|
||||||
tsdn = tsdn_fetch();
|
tsdn = tsdn_fetch();
|
||||||
|
|
||||||
base_t *base = base_new(tsdn, 0,
|
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks,
|
||||||
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
|
/* metadata_use_hooks */ true);
|
||||||
expect_ptr_not_null(base, "Unexpected base_new failure");
|
expect_ptr_not_null(base, "Unexpected base_new failure");
|
||||||
|
|
||||||
rtree_t *rtree = &test_rtree;
|
rtree_t *rtree = &test_rtree;
|
||||||
@ -53,8 +53,8 @@ TEST_BEGIN(test_rtree_extrema) {
|
|||||||
|
|
||||||
tsdn_t *tsdn = tsdn_fetch();
|
tsdn_t *tsdn = tsdn_fetch();
|
||||||
|
|
||||||
base_t *base = base_new(tsdn, 0,
|
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks,
|
||||||
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
|
/* metadata_use_hooks */ true);
|
||||||
expect_ptr_not_null(base, "Unexpected base_new failure");
|
expect_ptr_not_null(base, "Unexpected base_new failure");
|
||||||
|
|
||||||
rtree_t *rtree = &test_rtree;
|
rtree_t *rtree = &test_rtree;
|
||||||
@ -105,8 +105,8 @@ TEST_END
|
|||||||
|
|
||||||
TEST_BEGIN(test_rtree_bits) {
|
TEST_BEGIN(test_rtree_bits) {
|
||||||
tsdn_t *tsdn = tsdn_fetch();
|
tsdn_t *tsdn = tsdn_fetch();
|
||||||
base_t *base = base_new(tsdn, 0,
|
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks,
|
||||||
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
|
/* metadata_use_hooks */ true);
|
||||||
expect_ptr_not_null(base, "Unexpected base_new failure");
|
expect_ptr_not_null(base, "Unexpected base_new failure");
|
||||||
|
|
||||||
uintptr_t keys[] = {PAGE, PAGE + 1,
|
uintptr_t keys[] = {PAGE, PAGE + 1,
|
||||||
@ -155,8 +155,8 @@ TEST_BEGIN(test_rtree_random) {
|
|||||||
sfmt_t *sfmt = init_gen_rand(SEED);
|
sfmt_t *sfmt = init_gen_rand(SEED);
|
||||||
tsdn_t *tsdn = tsdn_fetch();
|
tsdn_t *tsdn = tsdn_fetch();
|
||||||
|
|
||||||
base_t *base = base_new(tsdn, 0,
|
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks,
|
||||||
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
|
/* metadata_use_hooks */ true);
|
||||||
expect_ptr_not_null(base, "Unexpected base_new failure");
|
expect_ptr_not_null(base, "Unexpected base_new failure");
|
||||||
|
|
||||||
uintptr_t keys[NSET];
|
uintptr_t keys[NSET];
|
||||||
@ -254,8 +254,8 @@ test_rtree_range_write(tsdn_t *tsdn, rtree_t *rtree, uintptr_t start,
|
|||||||
|
|
||||||
TEST_BEGIN(test_rtree_range) {
|
TEST_BEGIN(test_rtree_range) {
|
||||||
tsdn_t *tsdn = tsdn_fetch();
|
tsdn_t *tsdn = tsdn_fetch();
|
||||||
base_t *base = base_new(tsdn, 0,
|
base_t *base = base_new(tsdn, 0, &ehooks_default_extent_hooks,
|
||||||
&ehooks_default_extent_hooks, /* metadata_use_hooks */ true);
|
/* metadata_use_hooks */ true);
|
||||||
expect_ptr_not_null(base, "Unexpected base_new failure");
|
expect_ptr_not_null(base, "Unexpected base_new failure");
|
||||||
|
|
||||||
rtree_t *rtree = &test_rtree;
|
rtree_t *rtree = &test_rtree;
|
||||||
|
Loading…
Reference in New Issue
Block a user