Limit maximum number of purged slabs with option

Option `experimental_hpa_max_purge_nhp` introduced for backward
compatibility reasons: to make it possible to have behaviour similar
to buggy `hpa_strict_min_purge_interval` implementation.

When `experimental_hpa_max_purge_nhp` is set to -1, there is no limit
to number of slabs we'll purge on each iteration. Otherwise, we'll purge
no more than `experimental_hpa_max_purge_nhp` hugepages (slabs). This in
turn means we might not purge enough dirty pages to satisfy
`hpa_dirty_mult` requirement.

Combination of `hpa_dirty_mult`, `experimental_hpa_max_purge_nhp` and
`hpa_strict_min_purge_interval` options allows us to have steady rate of
pages returned back to the system. This provides a strickier latency
guarantees as number of `madvise` calls is bounded (and hence number of
TLB shootdowns is limited) in exchange to weaker memory usage
guarantees.
This commit is contained in:
Dmitry Ilvokhin
2024-08-06 08:47:57 -07:00
committed by Qi Wang
parent 143f458188
commit aaa29003ab
7 changed files with 109 additions and 6 deletions

View File

@@ -1565,6 +1565,7 @@ stats_general_print(emitter_t *emitter) {
OPT_WRITE_UINT64("hpa_hugify_delay_ms")
OPT_WRITE_UINT64("hpa_min_purge_interval_ms")
OPT_WRITE_BOOL("hpa_strict_min_purge_interval")
OPT_WRITE_SSIZE_T("experimental_hpa_max_purge_nhp")
if (je_mallctl("opt.hpa_dirty_mult", (void *)&u32v, &u32sz, NULL, 0)
== 0) {
/*