1 #ifndef JEMALLOC_INTERNAL_EXTENT_EXTERNS_H
2 #define JEMALLOC_INTERNAL_EXTENT_EXTERNS_H
3 
4 #include "jemalloc/internal/mutex.h"
5 #include "jemalloc/internal/mutex_pool.h"
6 #include "jemalloc/internal/ph.h"
7 #include "jemalloc/internal/rtree.h"
8 
9 extern size_t opt_lg_extent_max_active_fit;
10 
11 extern rtree_t extents_rtree;
12 extern const extent_hooks_t extent_hooks_default;
13 extern mutex_pool_t extent_mutex_pool;
14 
15 extent_t *extent_alloc(tsdn_t *tsdn, arena_t *arena);
16 void extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent);
17 
18 extent_hooks_t *extent_hooks_get(arena_t *arena);
19 extent_hooks_t *extent_hooks_set(tsd_t *tsd, arena_t *arena,
20     extent_hooks_t *extent_hooks);
21 
22 #ifdef JEMALLOC_JET
23 size_t extent_size_quantize_floor(size_t size);
24 size_t extent_size_quantize_ceil(size_t size);
25 #endif
26 
27 rb_proto(, extent_avail_, extent_tree_t, extent_t)
28 ph_proto(, extent_heap_, extent_heap_t, extent_t)
29 
30 bool extents_init(tsdn_t *tsdn, extents_t *extents, extent_state_t state,
31     bool delay_coalesce);
32 extent_state_t extents_state_get(const extents_t *extents);
33 size_t extents_npages_get(extents_t *extents);
34 extent_t *extents_alloc(tsdn_t *tsdn, arena_t *arena,
35     extent_hooks_t **r_extent_hooks, extents_t *extents, void *new_addr,
36     size_t size, size_t pad, size_t alignment, bool slab, szind_t szind,
37     bool *zero, bool *commit);
38 void extents_dalloc(tsdn_t *tsdn, arena_t *arena,
39     extent_hooks_t **r_extent_hooks, extents_t *extents, extent_t *extent);
40 extent_t *extents_evict(tsdn_t *tsdn, arena_t *arena,
41     extent_hooks_t **r_extent_hooks, extents_t *extents, size_t npages_min);
42 void extents_prefork(tsdn_t *tsdn, extents_t *extents);
43 void extents_postfork_parent(tsdn_t *tsdn, extents_t *extents);
44 void extents_postfork_child(tsdn_t *tsdn, extents_t *extents);
45 extent_t *extent_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
46     extent_hooks_t **r_extent_hooks, void *new_addr, size_t size, size_t pad,
47     size_t alignment, bool slab, szind_t szind, bool *zero, bool *commit);
48 void extent_dalloc_gap(tsdn_t *tsdn, arena_t *arena, extent_t *extent);
49 void extent_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena,
50     extent_hooks_t **r_extent_hooks, extent_t *extent);
51 void extent_destroy_wrapper(tsdn_t *tsdn, arena_t *arena,
52     extent_hooks_t **r_extent_hooks, extent_t *extent);
53 bool extent_commit_wrapper(tsdn_t *tsdn, arena_t *arena,
54     extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
55     size_t length);
56 bool extent_decommit_wrapper(tsdn_t *tsdn, arena_t *arena,
57     extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
58     size_t length);
59 bool extent_purge_lazy_wrapper(tsdn_t *tsdn, arena_t *arena,
60     extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
61     size_t length);
62 bool extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena,
63     extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
64     size_t length);
65 extent_t *extent_split_wrapper(tsdn_t *tsdn, arena_t *arena,
66     extent_hooks_t **r_extent_hooks, extent_t *extent, size_t size_a,
67     szind_t szind_a, bool slab_a, size_t size_b, szind_t szind_b, bool slab_b);
68 bool extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena,
69     extent_hooks_t **r_extent_hooks, extent_t *a, extent_t *b);
70 
71 bool extent_boot(void);
72 
73 #endif /* JEMALLOC_INTERNAL_EXTENT_EXTERNS_H */
74