1 1.1 christos #ifndef JEMALLOC_INTERNAL_HPA_OPTS_H 2 1.1 christos #define JEMALLOC_INTERNAL_HPA_OPTS_H 3 1.1 christos 4 1.1 christos #include "jemalloc/internal/fxp.h" 5 1.1 christos 6 1.1 christos /* 7 1.1 christos * This file is morally part of hpa.h, but is split out for header-ordering 8 1.1 christos * reasons. 9 1.1 christos */ 10 1.1 christos 11 1.1 christos typedef struct hpa_shard_opts_s hpa_shard_opts_t; 12 1.1 christos struct hpa_shard_opts_s { 13 1.1 christos /* 14 1.1 christos * The largest size we'll allocate out of the shard. For those 15 1.1 christos * allocations refused, the caller (in practice, the PA module) will 16 1.1 christos * fall back to the more general (for now) PAC, which can always handle 17 1.1 christos * any allocation request. 18 1.1 christos */ 19 1.1 christos size_t slab_max_alloc; 20 1.1 christos 21 1.1 christos /* 22 1.1 christos * When the number of active bytes in a hugepage is >= 23 1.1 christos * hugification_threshold, we force hugify it. 24 1.1 christos */ 25 1.1 christos size_t hugification_threshold; 26 1.1 christos 27 1.1 christos /* 28 1.1 christos * The HPA purges whenever the number of pages exceeds dirty_mult * 29 1.1 christos * active_pages. This may be set to (fxp_t)-1 to disable purging. 30 1.1 christos */ 31 1.1 christos fxp_t dirty_mult; 32 1.1 christos 33 1.1 christos /* 34 1.1 christos * Whether or not the PAI methods are allowed to defer work to a 35 1.1 christos * subsequent hpa_shard_do_deferred_work() call. Practically, this 36 1.1 christos * corresponds to background threads being enabled. We track this 37 1.1 christos * ourselves for encapsulation purposes. 38 1.1 christos */ 39 1.1 christos bool deferral_allowed; 40 1.1 christos 41 1.1 christos /* 42 1.1 christos * How long a hugepage has to be a hugification candidate before it will 43 1.1 christos * actually get hugified. 44 1.1 christos */ 45 1.1 christos uint64_t hugify_delay_ms; 46 1.1 christos 47 1.1 christos /* 48 1.1 christos * Minimum amount of time between purges. 49 1.1 christos */ 50 1.1 christos uint64_t min_purge_interval_ms; 51 1.1 christos }; 52 1.1 christos 53 1.1 christos #define HPA_SHARD_OPTS_DEFAULT { \ 54 1.1 christos /* slab_max_alloc */ \ 55 1.1 christos 64 * 1024, \ 56 1.1 christos /* hugification_threshold */ \ 57 1.1 christos HUGEPAGE * 95 / 100, \ 58 1.1 christos /* dirty_mult */ \ 59 1.1 christos FXP_INIT_PERCENT(25), \ 60 1.1 christos /* \ 61 1.1 christos * deferral_allowed \ 62 1.1 christos * \ 63 1.1 christos * Really, this is always set by the arena during creation \ 64 1.1 christos * or by an hpa_shard_set_deferral_allowed call, so the value \ 65 1.1 christos * we put here doesn't matter. \ 66 1.1 christos */ \ 67 1.1 christos false, \ 68 1.1 christos /* hugify_delay_ms */ \ 69 1.1 christos 10 * 1000, \ 70 1.1 christos /* min_purge_interval_ms */ \ 71 1.1 christos 5 * 1000 \ 72 1.1 christos } 73 1.1 christos 74 1.1 christos #endif /* JEMALLOC_INTERNAL_HPA_OPTS_H */ 75