1 #include "jemalloc/internal/jemalloc_preamble.h"
2 #include "jemalloc/internal/jemalloc_internal_includes.h"
4 #include "jemalloc/internal/bin.h"
5 #include "jemalloc/internal/witness.h"
7 const bin_info_t bin_infos[NBINS] = {
8 #define BIN_INFO_bin_yes(reg_size, slab_size, nregs) \
9 {reg_size, slab_size, nregs, BITMAP_INFO_INITIALIZER(nregs)},
10 #define BIN_INFO_bin_no(reg_size, slab_size, nregs)
11 #define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, \
13 BIN_INFO_bin_##bin((1U<<lg_grp) + (ndelta<<lg_delta), \
14 (pgs << LG_PAGE), (pgs << LG_PAGE) / ((1U<<lg_grp) + \
17 #undef BIN_INFO_bin_yes
18 #undef BIN_INFO_bin_no
23 bin_init(bin_t *bin) {
24 if (malloc_mutex_init(&bin->lock, "bin", WITNESS_RANK_BIN,
25 malloc_mutex_rank_exclusive)) {
29 extent_heap_new(&bin->slabs_nonfull);
30 extent_list_init(&bin->slabs_full);
32 memset(&bin->stats, 0, sizeof(bin_stats_t));
38 bin_prefork(tsdn_t *tsdn, bin_t *bin) {
39 malloc_mutex_prefork(tsdn, &bin->lock);
43 bin_postfork_parent(tsdn_t *tsdn, bin_t *bin) {
44 malloc_mutex_postfork_parent(tsdn, &bin->lock);
48 bin_postfork_child(tsdn_t *tsdn, bin_t *bin) {
49 malloc_mutex_postfork_child(tsdn, &bin->lock);