Extents: Split out extent struct.
This commit is contained in:
committed by
David Goldblatt
parent
41187bdfb0
commit
723ccc6c27
26
src/bin.c
26
src/bin.c
@@ -6,26 +6,6 @@
|
||||
#include "jemalloc/internal/sc.h"
|
||||
#include "jemalloc/internal/witness.h"
|
||||
|
||||
bin_info_t bin_infos[SC_NBINS];
|
||||
|
||||
static void
|
||||
bin_infos_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
|
||||
bin_info_t bin_infos[SC_NBINS]) {
|
||||
for (unsigned i = 0; i < SC_NBINS; i++) {
|
||||
bin_info_t *bin_info = &bin_infos[i];
|
||||
sc_t *sc = &sc_data->sc[i];
|
||||
bin_info->reg_size = ((size_t)1U << sc->lg_base)
|
||||
+ ((size_t)sc->ndelta << sc->lg_delta);
|
||||
bin_info->slab_size = (sc->pgs << LG_PAGE);
|
||||
bin_info->nregs =
|
||||
(uint32_t)(bin_info->slab_size / bin_info->reg_size);
|
||||
bin_info->n_shards = bin_shard_sizes[i];
|
||||
bitmap_info_t bitmap_info = BITMAP_INFO_INITIALIZER(
|
||||
bin_info->nregs);
|
||||
bin_info->bitmap_info = bitmap_info;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bin_update_shard_size(unsigned bin_shard_sizes[SC_NBINS], size_t start_size,
|
||||
size_t end_size, size_t nshards) {
|
||||
@@ -58,12 +38,6 @@ bin_shard_sizes_boot(unsigned bin_shard_sizes[SC_NBINS]) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bin_boot(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]) {
|
||||
assert(sc_data->initialized);
|
||||
bin_infos_init(sc_data, bin_shard_sizes, bin_infos);
|
||||
}
|
||||
|
||||
bool
|
||||
bin_init(bin_t *bin) {
|
||||
if (malloc_mutex_init(&bin->lock, "bin", WITNESS_RANK_BIN,
|
||||
|
30
src/bin_info.c
Normal file
30
src/bin_info.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "jemalloc/internal/jemalloc_preamble.h"
|
||||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||
|
||||
#include "jemalloc/internal/bin_info.h"
|
||||
|
||||
bin_info_t bin_infos[SC_NBINS];
|
||||
|
||||
static void
|
||||
bin_infos_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
|
||||
bin_info_t bin_infos[SC_NBINS]) {
|
||||
for (unsigned i = 0; i < SC_NBINS; i++) {
|
||||
bin_info_t *bin_info = &bin_infos[i];
|
||||
sc_t *sc = &sc_data->sc[i];
|
||||
bin_info->reg_size = ((size_t)1U << sc->lg_base)
|
||||
+ ((size_t)sc->ndelta << sc->lg_delta);
|
||||
bin_info->slab_size = (sc->pgs << LG_PAGE);
|
||||
bin_info->nregs =
|
||||
(uint32_t)(bin_info->slab_size / bin_info->reg_size);
|
||||
bin_info->n_shards = bin_shard_sizes[i];
|
||||
bitmap_info_t bitmap_info = BITMAP_INFO_INITIALIZER(
|
||||
bin_info->nregs);
|
||||
bin_info->bitmap_info = bitmap_info;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bin_info_boot(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]) {
|
||||
assert(sc_data->initialized);
|
||||
bin_infos_init(sc_data, bin_shard_sizes, bin_infos);
|
||||
}
|
@@ -1488,8 +1488,8 @@ malloc_init_hard_a0_locked() {
|
||||
* Ordering here is somewhat tricky; we need sc_boot() first, since that
|
||||
* determines what the size classes will be, and then
|
||||
* malloc_conf_init(), since any slab size tweaking will need to be done
|
||||
* before sz_boot and bin_boot, which assume that the values they read
|
||||
* out of sc_data_global are final.
|
||||
* before sz_boot and bin_info_boot, which assume that the values they
|
||||
* read out of sc_data_global are final.
|
||||
*/
|
||||
sc_boot(&sc_data);
|
||||
unsigned bin_shard_sizes[SC_NBINS];
|
||||
@@ -1504,7 +1504,7 @@ malloc_init_hard_a0_locked() {
|
||||
}
|
||||
malloc_conf_init(&sc_data, bin_shard_sizes);
|
||||
sz_boot(&sc_data);
|
||||
bin_boot(&sc_data, bin_shard_sizes);
|
||||
bin_info_boot(&sc_data, bin_shard_sizes);
|
||||
|
||||
if (opt_stats_print) {
|
||||
/* Print statistics at exit. */
|
||||
|
Reference in New Issue
Block a user