2019-12-04 10:31:47 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_EXTENT2_H
|
|
|
|
#define JEMALLOC_INTERNAL_EXTENT2_H
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2019-12-13 08:25:24 +08:00
|
|
|
#include "jemalloc/internal/ecache.h"
|
2019-12-03 06:19:22 +08:00
|
|
|
#include "jemalloc/internal/ehooks.h"
|
2017-04-11 07:54:25 +08:00
|
|
|
#include "jemalloc/internal/ph.h"
|
2017-05-24 05:26:31 +08:00
|
|
|
#include "jemalloc/internal/rtree.h"
|
2017-04-11 07:54:25 +08:00
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
/*
|
|
|
|
* This module contains the page-level allocator. It chooses the addresses that
|
|
|
|
* allocations requested by other modules will inhabit, and updates the global
|
|
|
|
* metadata to reflect allocation/deallocation/purging decisions.
|
|
|
|
*
|
|
|
|
* The naming ("extent2" for the module, and "extent_" or "extents_" for most of
|
|
|
|
* the functions) is historical. Eventually, the naming should be updated to
|
|
|
|
* reflect the functionality. Similarly, the utilization stats live here for no
|
|
|
|
* particular reason. This will also be changed, but much more immediately.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When reuse (and split) an active extent, (1U << opt_lg_extent_max_active_fit)
|
|
|
|
* is the max ratio between the size of the active extent and the new extent.
|
|
|
|
*/
|
|
|
|
#define LG_EXTENT_MAX_ACTIVE_FIT_DEFAULT 6
|
2017-11-10 05:51:39 +08:00
|
|
|
extern size_t opt_lg_extent_max_active_fit;
|
|
|
|
|
|
|
|
extern rtree_t extents_rtree;
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *extents_alloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-13 08:25:24 +08:00
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
2019-12-03 06:19:22 +08:00
|
|
|
bool slab, szind_t szind, bool *zero, bool *commit);
|
2019-12-13 09:30:28 +08:00
|
|
|
edata_t *extents_alloc_grow(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
|
|
|
ecache_t *ecache, void *new_addr, size_t size, size_t pad, size_t alignment,
|
|
|
|
bool slab, szind_t szind, bool *zero, bool *commit);
|
2019-12-03 06:19:22 +08:00
|
|
|
void extents_dalloc(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-13 08:25:24 +08:00
|
|
|
ecache_t *ecache, edata_t *edata);
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *extents_evict(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-13 08:25:24 +08:00
|
|
|
ecache_t *ecache, size_t npages_min);
|
2019-12-13 09:30:28 +08:00
|
|
|
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *extent_alloc_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-03 06:19:22 +08:00
|
|
|
void *new_addr, size_t size, size_t pad, size_t alignment, bool slab,
|
|
|
|
szind_t szind, bool *zero, bool *commit);
|
2019-12-10 06:36:45 +08:00
|
|
|
void extent_dalloc_gap(tsdn_t *tsdn, arena_t *arena, edata_t *edata);
|
2019-12-03 06:19:22 +08:00
|
|
|
void extent_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata);
|
2019-12-03 06:19:22 +08:00
|
|
|
void extent_destroy_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata);
|
2019-12-14 05:46:25 +08:00
|
|
|
bool extent_commit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length);
|
|
|
|
bool extent_decommit_wrapper(tsdn_t *tsdn, ehooks_t *ehooks, edata_t *edata,
|
|
|
|
size_t offset, size_t length);
|
2019-12-03 06:19:22 +08:00
|
|
|
bool extent_purge_lazy_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata, size_t offset, size_t length);
|
2019-12-03 06:19:22 +08:00
|
|
|
bool extent_purge_forced_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
2019-12-10 06:36:45 +08:00
|
|
|
edata_t *edata, size_t offset, size_t length);
|
|
|
|
edata_t *extent_split_wrapper(tsdn_t *tsdn, arena_t *arena, ehooks_t *ehooks,
|
|
|
|
edata_t *edata, size_t size_a, szind_t szind_a, bool slab_a,
|
2019-12-03 06:19:22 +08:00
|
|
|
size_t size_b, szind_t szind_b, bool slab_b);
|
2019-12-14 03:16:58 +08:00
|
|
|
bool extent_merge_wrapper(tsdn_t *tsdn, ehooks_t *ehooks,
|
|
|
|
edata_cache_t *edata_cache, edata_t *a, edata_t *b);
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2017-03-14 08:36:57 +08:00
|
|
|
bool extent_boot(void);
|
2017-01-11 10:06:31 +08:00
|
|
|
|
2019-12-04 10:31:47 +08:00
|
|
|
#endif /* JEMALLOC_INTERNAL_EXTENT2_H */
|