mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 22:51:50 +03:00
Support THP with Huge Arena in PAC
This commit is contained in:
parent
86bbabac32
commit
e1a77ec558
9 changed files with 158 additions and 8 deletions
|
|
@ -30,6 +30,9 @@ extern emap_t arena_emap_global;
|
|||
extern size_t opt_oversize_threshold;
|
||||
extern size_t oversize_threshold;
|
||||
|
||||
extern bool opt_huge_arena_pac_thp;
|
||||
extern pac_thp_t huge_arena_pac_thp;
|
||||
|
||||
/*
|
||||
* arena_bin_offsets[binind] is the offset of the first bin shard for size class
|
||||
* binind.
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ extern unsigned manual_arena_base;
|
|||
*/
|
||||
extern atomic_p_t arenas[];
|
||||
|
||||
extern unsigned huge_arena_ind;
|
||||
|
||||
void *a0malloc(size_t size);
|
||||
void a0dalloc(void *ptr);
|
||||
void *bootstrap_malloc(size_t size);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,31 @@ struct pac_s {
|
|||
atomic_zu_t extent_sn_next;
|
||||
};
|
||||
|
||||
typedef struct pac_thp_s pac_thp_t;
|
||||
struct pac_thp_s {
|
||||
/*
|
||||
* opt_thp controls THP for user requested allocations. Settings
|
||||
* "always", "never" and "default" are available if THP is supported
|
||||
* by the OS and the default extent hooks are used:
|
||||
* - "always" and "never" are convered by pages_set_thp_state() in
|
||||
* ehooks_default_alloc_impl().
|
||||
* - "default" makes no change for all the other auto arenas except
|
||||
* the huge arena. For the huge arena, we might also look at
|
||||
* opt_metadata_thp to decide whether to use THP or not.
|
||||
* This is a temporary remedy before HPA is fully supported.
|
||||
*/
|
||||
bool thp_madvise;
|
||||
/* Below fields are protected by the lock. */
|
||||
malloc_mutex_t lock;
|
||||
bool auto_thp_switched;
|
||||
atomic_u_t n_thp_lazy;
|
||||
/*
|
||||
* List that tracks HUGEPAGE aligned regions that're lazily hugified
|
||||
* in auto thp mode.
|
||||
*/
|
||||
edata_list_active_t thp_lazy_list;
|
||||
};
|
||||
|
||||
bool pac_init(tsdn_t *tsdn, pac_t *pac, base_t *base, emap_t *emap,
|
||||
edata_cache_t *edata_cache, nstime_t *cur_time, size_t oversize_threshold,
|
||||
ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms, pac_stats_t *pac_stats,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue