MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / arena_i_decay_ms_ctl_impl

Function arena_i_decay_ms_ctl_impl

deps/jemalloc/src/ctl.c:2308–2354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2306}
2307
2308static int
2309arena_i_decay_ms_ctl_impl(tsd_t *tsd, const size_t *mib, size_t miblen,
2310 void *oldp, size_t *oldlenp, void *newp, size_t newlen, bool dirty) {
2311 int ret;
2312 unsigned arena_ind;
2313 arena_t *arena;
2314
2315 MIB_UNSIGNED(arena_ind, 1);
2316 arena = arena_get(tsd_tsdn(tsd), arena_ind, false);
2317 if (arena == NULL) {
2318 ret = EFAULT;
2319 goto label_return;
2320 }
2321
2322 if (oldp != NULL && oldlenp != NULL) {
2323 size_t oldval = dirty ? arena_dirty_decay_ms_get(arena) :
2324 arena_muzzy_decay_ms_get(arena);
2325 READ(oldval, ssize_t);
2326 }
2327 if (newp != NULL) {
2328 if (newlen != sizeof(ssize_t)) {
2329 ret = EINVAL;
2330 goto label_return;
2331 }
2332 if (arena_is_huge(arena_ind) && *(ssize_t *)newp > 0) {
2333 /*
2334 * By default the huge arena purges eagerly. If it is
2335 * set to non-zero decay time afterwards, background
2336 * thread might be needed.
2337 */
2338 if (background_thread_create(tsd, arena_ind)) {
2339 ret = EFAULT;
2340 goto label_return;
2341 }
2342 }
2343 if (dirty ? arena_dirty_decay_ms_set(tsd_tsdn(tsd), arena,
2344 *(ssize_t *)newp) : arena_muzzy_decay_ms_set(tsd_tsdn(tsd),
2345 arena, *(ssize_t *)newp)) {
2346 ret = EFAULT;
2347 goto label_return;
2348 }
2349 }
2350
2351 ret = 0;
2352label_return:
2353 return ret;
2354}
2355
2356static int
2357arena_i_dirty_decay_ms_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,

Callers 2

Calls 8

arena_is_hugeFunction · 0.85
arena_dirty_decay_ms_getFunction · 0.70
arena_muzzy_decay_ms_getFunction · 0.70
background_thread_createFunction · 0.70
arena_dirty_decay_ms_setFunction · 0.70
arena_muzzy_decay_ms_setFunction · 0.70
arena_getFunction · 0.50
tsd_tsdnFunction · 0.50

Tested by

no test coverage detected