From cdb916ed3f76f348891d4f2a83f38bd70ed75067 Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Mon, 9 Mar 2020 18:37:23 -0700 Subject: [PATCH] Decay: Add comments for the public API. --- include/jemalloc/internal/decay.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/jemalloc/internal/decay.h b/include/jemalloc/internal/decay.h index ef336f07..b1e80f53 100644 --- a/include/jemalloc/internal/decay.h +++ b/include/jemalloc/internal/decay.h @@ -81,11 +81,19 @@ struct decay_s { uint64_t ceil_npages; }; +/* + * The current decay time setting. This is the only public access to a decay_t + * that's allowed without holding mtx. + */ static inline ssize_t decay_ms_read(const decay_t *decay) { return atomic_load_zd(&decay->time_ms, ATOMIC_RELAXED); } +/* + * See the comment on the struct field -- the limit on pages we should allow in + * this decay state this epoch. + */ static inline size_t decay_npages_limit_get(const decay_t *decay) { return decay->npages_limit; @@ -97,6 +105,16 @@ decay_epoch_npages_delta(const decay_t *decay) { return decay->backlog[SMOOTHSTEP_NSTEPS - 1]; } +/* + * Returns true if the passed in decay time setting is valid. + * < -1 : invalid + * -1 : never decay + * 0 : decay immediately + * > 0 : some positive decay time, up to a maximum allowed value of + * NSTIME_SEC_MAX * 1000, which corresponds to decaying somewhere in the early + * 27th century. By that time, we expect to have implemented alternate purging + * strategies. + */ bool decay_ms_valid(ssize_t decay_ms); /*