Baton - flushing of thread-local memory during a long wait
Summary:
This diff causes Baton to reduce a thread's memory footprint when it
blocks for an extended period (by default 5 to 7.5 seconds). Reductions
are achieved by flushing the thread-local jemalloc caches (if jemalloc
is in use) and by calling madvise(MADV_DONTNEED) on the portion of the
thread's stack that isn't active. Once the thread resumes execution
both of these resources will be reallocated. Configuration is via
system-wide default.
Test Plan:
1. new unit tests
2. manual execution of existing unit tests with very low idleTimeout
3. peek and poke with gdb to observe madvise discarding the page
Reviewed By: davejwatson@fb.com
FB internal diff:
D1146966