1 #ifndef JEMALLOC_INTERNAL_BIN_INFO_H 2 #define JEMALLOC_INTERNAL_BIN_INFO_H 3 4 #include "jemalloc/internal/bitmap.h" 5 6 /* 7 * Read-only information associated with each element of arena_t's bins array 8 * is stored separately, partly to reduce memory usage (only one copy, rather 9 * than one per arena), but mainly to avoid false cacheline sharing. 10 * 11 * Each slab has the following layout: 12 * 13 * /--------------------\ 14 * | region 0 | 15 * |--------------------| 16 * | region 1 | 17 * |--------------------| 18 * | ... | 19 * | ... | 20 * | ... | 21 * |--------------------| 22 * | region nregs-1 | 23 * \--------------------/ 24 */ 25 typedef struct bin_info_s bin_info_t; 26 struct bin_info_s { 27 /* Size of regions in a slab for this bin's size class. */ 28 size_t reg_size; 29 30 /* Total size of a slab for this bin's size class. */ 31 size_t slab_size; 32 33 /* Total number of regions in a slab for this bin's size class. */ 34 uint32_t nregs; 35 36 /* Number of sharded bins in each arena for this size class. */ 37 uint32_t n_shards; 38 39 /* 40 * Metadata used to manipulate bitmaps for slabs associated with this 41 * bin. 42 */ 43 bitmap_info_t bitmap_info; 44 }; 45 46 extern bin_info_t bin_infos[SC_NBINS]; 47 48 void bin_info_boot(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]); 49 50 #endif /* JEMALLOC_INTERNAL_BIN_INFO_H */ 51