xref: /freebsd/contrib/jemalloc/include/jemalloc/internal/arena_types.h (revision c5ad81420c495d1d5de04209b0ec4fcb435c322c)
1 #ifndef JEMALLOC_INTERNAL_ARENA_TYPES_H
2 #define JEMALLOC_INTERNAL_ARENA_TYPES_H
3 
4 #include "jemalloc/internal/sc.h"
5 
6 /* Maximum number of regions in one slab. */
7 #define LG_SLAB_MAXREGS		(LG_PAGE - SC_LG_TINY_MIN)
8 #define SLAB_MAXREGS		(1U << LG_SLAB_MAXREGS)
9 
10 /* Default decay times in milliseconds. */
11 #define DIRTY_DECAY_MS_DEFAULT	ZD(10 * 1000)
12 #define MUZZY_DECAY_MS_DEFAULT	(0)
13 /* Number of event ticks between time checks. */
14 #define DECAY_NTICKS_PER_UPDATE	1000
15 
16 typedef struct arena_slab_data_s arena_slab_data_t;
17 typedef struct arena_decay_s arena_decay_t;
18 typedef struct arena_s arena_t;
19 typedef struct arena_tdata_s arena_tdata_t;
20 typedef struct alloc_ctx_s alloc_ctx_t;
21 
22 typedef enum {
23 	percpu_arena_mode_names_base   = 0, /* Used for options processing. */
24 
25 	/*
26 	 * *_uninit are used only during bootstrapping, and must correspond
27 	 * to initialized variant plus percpu_arena_mode_enabled_base.
28 	 */
29 	percpu_arena_uninit            = 0,
30 	per_phycpu_arena_uninit        = 1,
31 
32 	/* All non-disabled modes must come after percpu_arena_disabled. */
33 	percpu_arena_disabled          = 2,
34 
35 	percpu_arena_mode_names_limit  = 3, /* Used for options processing. */
36 	percpu_arena_mode_enabled_base = 3,
37 
38 	percpu_arena                   = 3,
39 	per_phycpu_arena               = 4  /* Hyper threads share arena. */
40 } percpu_arena_mode_t;
41 
42 #define PERCPU_ARENA_ENABLED(m)	((m) >= percpu_arena_mode_enabled_base)
43 #define PERCPU_ARENA_DEFAULT	percpu_arena_disabled
44 
45 /*
46  * When allocation_size >= oversize_threshold, use the dedicated huge arena
47  * (unless have explicitly spicified arena index).  0 disables the feature.
48  */
49 #define OVERSIZE_THRESHOLD_DEFAULT (8 << 20)
50 
51 #endif /* JEMALLOC_INTERNAL_ARENA_TYPES_H */
52