2017-01-11 10:06:31 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_EXTENT_EXTERNS_H
|
|
|
|
#define JEMALLOC_INTERNAL_EXTENT_EXTERNS_H
|
|
|
|
|
2017-05-24 03:28:19 +08:00
|
|
|
#include "jemalloc/internal/mutex.h"
|
2017-04-11 07:54:25 +08:00
|
|
|
#include "jemalloc/internal/ph.h"
|
2017-05-24 03:28:19 +08:00
|
|
|
#include "jemalloc/internal/rb.h"
|
2017-04-11 07:54:25 +08:00
|
|
|
|
2017-01-11 10:06:31 +08:00
|
|
|
extern rtree_t extents_rtree;
|
|
|
|
extern const extent_hooks_t extent_hooks_default;
|
2017-05-16 05:23:51 +08:00
|
|
|
extern mutex_pool_t extent_mutex_pool;
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2017-03-14 08:36:57 +08:00
|
|
|
extent_t *extent_alloc(tsdn_t *tsdn, arena_t *arena);
|
|
|
|
void extent_dalloc(tsdn_t *tsdn, arena_t *arena, extent_t *extent);
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2017-03-14 08:36:57 +08:00
|
|
|
extent_hooks_t *extent_hooks_get(arena_t *arena);
|
|
|
|
extent_hooks_t *extent_hooks_set(arena_t *arena, extent_hooks_t *extent_hooks);
|
2017-01-11 10:06:31 +08:00
|
|
|
|
|
|
|
#ifdef JEMALLOC_JET
|
2017-03-14 08:36:57 +08:00
|
|
|
size_t extent_size_quantize_floor(size_t size);
|
|
|
|
size_t extent_size_quantize_ceil(size_t size);
|
2017-01-11 10:06:31 +08:00
|
|
|
#endif
|
|
|
|
|
2017-04-17 13:31:16 +08:00
|
|
|
rb_proto(, extent_avail_, extent_tree_t, extent_t)
|
2017-01-11 10:06:31 +08:00
|
|
|
ph_proto(, extent_heap_, extent_heap_t, extent_t)
|
|
|
|
|
2017-02-13 15:18:57 +08:00
|
|
|
bool extents_init(tsdn_t *tsdn, extents_t *extents, extent_state_t state,
|
2017-03-03 10:04:35 +08:00
|
|
|
bool delay_coalesce);
|
2017-01-30 13:57:14 +08:00
|
|
|
extent_state_t extents_state_get(const extents_t *extents);
|
|
|
|
size_t extents_npages_get(extents_t *extents);
|
Implement two-phase decay-based purging.
Split decay-based purging into two phases, the first of which uses lazy
purging to convert dirty pages to "muzzy", and the second of which uses
forced purging, decommit, or unmapping to convert pages to clean or
destroy them altogether. Not all operating systems support lazy
purging, yet the application may provide extent hooks that implement
lazy purging, so care must be taken to dynamically omit the first phase
when necessary.
The mallctl interfaces change as follows:
- opt.decay_time --> opt.{dirty,muzzy}_decay_time
- arena.<i>.decay_time --> arena.<i>.{dirty,muzzy}_decay_time
- arenas.decay_time --> arenas.{dirty,muzzy}_decay_time
- stats.arenas.<i>.pdirty --> stats.arenas.<i>.p{dirty,muzzy}
- stats.arenas.<i>.{npurge,nmadvise,purged} -->
stats.arenas.<i>.{dirty,muzzy}_{npurge,nmadvise,purged}
This resolves #521.
2017-03-09 14:42:57 +08:00
|
|
|
extent_t *extents_alloc(tsdn_t *tsdn, arena_t *arena,
|
|
|
|
extent_hooks_t **r_extent_hooks, extents_t *extents, void *new_addr,
|
2017-03-14 08:36:57 +08:00
|
|
|
size_t size, size_t pad, size_t alignment, bool slab, szind_t szind,
|
|
|
|
bool *zero, bool *commit);
|
Implement two-phase decay-based purging.
Split decay-based purging into two phases, the first of which uses lazy
purging to convert dirty pages to "muzzy", and the second of which uses
forced purging, decommit, or unmapping to convert pages to clean or
destroy them altogether. Not all operating systems support lazy
purging, yet the application may provide extent hooks that implement
lazy purging, so care must be taken to dynamically omit the first phase
when necessary.
The mallctl interfaces change as follows:
- opt.decay_time --> opt.{dirty,muzzy}_decay_time
- arena.<i>.decay_time --> arena.<i>.{dirty,muzzy}_decay_time
- arenas.decay_time --> arenas.{dirty,muzzy}_decay_time
- stats.arenas.<i>.pdirty --> stats.arenas.<i>.p{dirty,muzzy}
- stats.arenas.<i>.{npurge,nmadvise,purged} -->
stats.arenas.<i>.{dirty,muzzy}_{npurge,nmadvise,purged}
This resolves #521.
2017-03-09 14:42:57 +08:00
|
|
|
void extents_dalloc(tsdn_t *tsdn, arena_t *arena,
|
|
|
|
extent_hooks_t **r_extent_hooks, extents_t *extents, extent_t *extent);
|
2017-03-03 10:04:35 +08:00
|
|
|
extent_t *extents_evict(tsdn_t *tsdn, arena_t *arena,
|
|
|
|
extent_hooks_t **r_extent_hooks, extents_t *extents, size_t npages_min);
|
2017-01-30 13:57:14 +08:00
|
|
|
void extents_prefork(tsdn_t *tsdn, extents_t *extents);
|
|
|
|
void extents_postfork_parent(tsdn_t *tsdn, extents_t *extents);
|
|
|
|
void extents_postfork_child(tsdn_t *tsdn, extents_t *extents);
|
2017-03-14 08:36:57 +08:00
|
|
|
extent_t *extent_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
|
|
|
|
extent_hooks_t **r_extent_hooks, void *new_addr, size_t size, size_t pad,
|
|
|
|
size_t alignment, bool slab, szind_t szind, bool *zero, bool *commit);
|
|
|
|
void extent_dalloc_gap(tsdn_t *tsdn, arena_t *arena, extent_t *extent);
|
|
|
|
void extent_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent);
|
2017-04-28 06:51:35 +08:00
|
|
|
void extent_destroy_wrapper(tsdn_t *tsdn, arena_t *arena,
|
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent);
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_commit_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
|
|
|
|
size_t length);
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_decommit_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
|
|
|
|
size_t length);
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_purge_lazy_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
|
|
|
|
size_t length);
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t offset,
|
|
|
|
size_t length);
|
2017-03-14 08:36:57 +08:00
|
|
|
extent_t *extent_split_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *extent, size_t size_a,
|
2017-03-17 08:57:52 +08:00
|
|
|
szind_t szind_a, bool slab_a, size_t size_b, szind_t szind_b, bool slab_b);
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena,
|
2017-01-11 10:06:31 +08:00
|
|
|
extent_hooks_t **r_extent_hooks, extent_t *a, extent_t *b);
|
|
|
|
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_boot(void);
|
2017-01-11 10:06:31 +08:00
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_EXTENT_EXTERNS_H */
|