1 | #include "jemalloc/internal/jemalloc_preamble.h" |
---|---|
2 | #include "jemalloc/internal/jemalloc_internal_includes.h" |
3 | |
4 | #include "jemalloc/internal/bin_info.h" |
5 | |
6 | bin_info_t bin_infos[SC_NBINS]; |
7 | |
8 | static void |
9 | bin_infos_init(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS], |
10 | bin_info_t infos[SC_NBINS]) { |
11 | for (unsigned i = 0; i < SC_NBINS; i++) { |
12 | bin_info_t *bin_info = &infos[i]; |
13 | sc_t *sc = &sc_data->sc[i]; |
14 | bin_info->reg_size = ((size_t)1U << sc->lg_base) |
15 | + ((size_t)sc->ndelta << sc->lg_delta); |
16 | bin_info->slab_size = (sc->pgs << LG_PAGE); |
17 | bin_info->nregs = |
18 | (uint32_t)(bin_info->slab_size / bin_info->reg_size); |
19 | bin_info->n_shards = bin_shard_sizes[i]; |
20 | bitmap_info_t bitmap_info = BITMAP_INFO_INITIALIZER( |
21 | bin_info->nregs); |
22 | bin_info->bitmap_info = bitmap_info; |
23 | } |
24 | } |
25 | |
26 | void |
27 | bin_info_boot(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]) { |
28 | assert(sc_data->initialized); |
29 | bin_infos_init(sc_data, bin_shard_sizes, bin_infos); |
30 | } |
31 |