Skip to content

Make tcache GC interval configurable - #3003

Open
suyashmahar wants to merge 2 commits into
jemalloc:devfrom
suyashmahar:feat-tcache-gc-interval
Open

suyashmahar wants to merge 2 commits into
jemalloc:devfrom
suyashmahar:feat-tcache-gc-interval

Conversation

@suyashmahar

Copy link
Copy Markdown

Add support for making tcache GC interval configurable. This needed for profiling tools that considerably slow down the workload (20x or more) resulting in the GC running 20x more frequently under profiling than the rest of the workload.

Set it in milliseconds at startup with MALLOC_CONF=tcache_gc_interval_ms:N (default 10), or adjust it at run time by writing tcache.gc_interval_ms via mallctl.

Tests:

./test/unit/mallctl 2>&1 | grep gc_interval
test_tcache_gc_interval_ms (non-reentrant): pass
test_tcache_gc_interval_ms (libc-reentrant): pass
test_tcache_gc_interval_ms (arena_new-reentrant): pass

Replace the hard-coded 10ms TCACHE_GC_INTERVAL_NS with an
opt.tcache_gc_interval_ms startup option plus a writable
tcache.gc_interval_ms mallctl for run-time tuning. The live value is
kept in ms and converted to ns on the GC path, so large intervals
cannot overflow size_t on 32-bit platforms.

Stats output shows both the boot and live values via
OPT_WRITE_SIZE_T_MUTABLE.

Test Plan:
Built lib/libjemalloc.so.2 clean; test/unit/mallctl passes
(189/204 pass, 15 skip, 0 fail) including new test_tcache_gc_interval_ms;
test/unit/stats passes (8/10 pass, 2 skip, 0 fail).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant