HPA: Add min_purge_interval_ms option

This rate limiting option is required to avoid purging too often.
This commit is contained in:
Alex Lapenkou 2021-08-18 12:22:43 -07:00 committed by Alexander Lapenkov
parent b8b8027f19
commit 97da57c13a
4 changed files with 21 additions and 3 deletions

View File

@ -43,6 +43,11 @@ struct hpa_shard_opts_s {
* actually get hugified.
*/
uint64_t hugify_delay_ms;
/*
* Minimum amount of time between purges.
*/
uint64_t min_purge_interval_ms;
};
#define HPA_SHARD_OPTS_DEFAULT { \
@ -61,7 +66,9 @@ struct hpa_shard_opts_s {
*/ \
false, \
/* hugify_delay_ms */ \
10 * 1000 \
10 * 1000, \
/* min_purge_interval_ms */ \
5 * 1000 \
}
#endif /* JEMALLOC_INTERNAL_HPA_OPTS_H */

View File

@ -97,6 +97,7 @@ CTL_PROTO(opt_hpa)
CTL_PROTO(opt_hpa_slab_max_alloc)
CTL_PROTO(opt_hpa_hugification_threshold)
CTL_PROTO(opt_hpa_hugify_delay_ms)
CTL_PROTO(opt_hpa_min_purge_interval_ms)
CTL_PROTO(opt_hpa_dirty_mult)
CTL_PROTO(opt_hpa_sec_nshards)
CTL_PROTO(opt_hpa_sec_max_alloc)
@ -408,6 +409,7 @@ static const ctl_named_node_t opt_node[] = {
{NAME("hpa_hugification_threshold"),
CTL(opt_hpa_hugification_threshold)},
{NAME("hpa_hugify_delay_ms"), CTL(opt_hpa_hugify_delay_ms)},
{NAME("hpa_min_purge_interval_ms"), CTL(opt_hpa_min_purge_interval_ms)},
{NAME("hpa_dirty_mult"), CTL(opt_hpa_dirty_mult)},
{NAME("hpa_sec_nshards"), CTL(opt_hpa_sec_nshards)},
{NAME("hpa_sec_max_alloc"), CTL(opt_hpa_sec_max_alloc)},
@ -2116,6 +2118,8 @@ CTL_RO_NL_GEN(opt_hpa, opt_hpa, bool)
CTL_RO_NL_GEN(opt_hpa_hugification_threshold,
opt_hpa_opts.hugification_threshold, size_t)
CTL_RO_NL_GEN(opt_hpa_hugify_delay_ms, opt_hpa_opts.hugify_delay_ms, uint64_t)
CTL_RO_NL_GEN(opt_hpa_min_purge_interval_ms, opt_hpa_opts.min_purge_interval_ms,
uint64_t)
/*
* This will have to change before we publicly document this option; fxp_t and

View File

@ -1447,9 +1447,15 @@ malloc_conf_init_helper(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS],
CONF_CONTINUE;
}
CONF_HANDLE_SIZE_T(
CONF_HANDLE_UINT64_T(
opt_hpa_opts.hugify_delay_ms, "hpa_hugify_delay_ms",
0, 0, CONF_CHECK_MIN, CONF_DONT_CHECK_MAX, true);
0, 0, CONF_DONT_CHECK_MIN, CONF_DONT_CHECK_MAX,
false);
CONF_HANDLE_UINT64_T(
opt_hpa_opts.min_purge_interval_ms,
"hpa_min_purge_interval_ms", 0, 0,
CONF_DONT_CHECK_MIN, CONF_DONT_CHECK_MAX, false);
if (CONF_MATCH("hpa_dirty_mult")) {
if (CONF_MATCH_VALUE("-1")) {

View File

@ -1472,6 +1472,7 @@ stats_general_print(emitter_t *emitter) {
OPT_WRITE_SIZE_T("hpa_slab_max_alloc")
OPT_WRITE_SIZE_T("hpa_hugification_threshold")
OPT_WRITE_UINT64("hpa_hugify_delay_ms")
OPT_WRITE_UINT64("hpa_min_purge_interval_ms")
if (je_mallctl("opt.hpa_dirty_mult", (void *)&u32v, &u32sz, NULL, 0)
== 0) {
/*