| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
When not using libdl, still allows background_thread to be enabled.
|
| |
|
|
|
|
| |
For low arena count settings, the huge threshold feature may trigger an unwanted
bg thd creation. Given that the huge arena does eager purging by default,
bypass bg thd creation when initializing the huge arena.
|
| |
|
|
|
| |
The setting has been tested in production for a while. No negative effect while
we were able to reduce number of threads per process.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this commit jemalloc produced many warnings when compiled with -Wextra
with both Clang and GCC. This commit fixes the issues raised by these warnings
or suppresses them if they were spurious at least for the Clang and GCC
versions covered by CI.
This commit:
* adds `JEMALLOC_DIAGNOSTIC` macros: `JEMALLOC_DIAGNOSTIC_{PUSH,POP}` are
used to modify the stack of enabled diagnostics. The
`JEMALLOC_DIAGNOSTIC_IGNORE_...` macros are used to ignore a concrete
diagnostic.
* adds `JEMALLOC_FALLTHROUGH` macro to explicitly state that falling
through `case` labels in a `switch` statement is intended
* Removes all UNUSED annotations on function parameters. The warning
-Wunused-parameter is now disabled globally in
`jemalloc_internal_macros.h` for all translation units that include
that header. It is never re-enabled since that header cannot be
included by users.
* locally suppresses some -Wextra diagnostics:
* `-Wmissing-field-initializer` is buggy in older Clang and GCC versions,
where it does not understanding that, in C, `= {0}` is a common C idiom
to initialize a struct to zero
* `-Wtype-bounds` is suppressed in a particular situation where a generic
macro, used in multiple different places, compares an unsigned integer for
smaller than zero, which is always true.
* `-Walloc-larger-than-size=` diagnostics warn when an allocation function is
called with a size that is too large (out-of-range). These are suppressed in
the parts of the tests where `jemalloc` explicitly does this to test that the
allocation functions fail properly.
* adds a new CI build bot that runs the log unit test on CI.
Closes #1196 .
|
| | |
|
| |
|
|
|
| |
Background threads are created without holding the global background_thread
lock, which mean paused state is possible (and fine).
|
| |
|
|
|
| |
If no lazy lock or background thread is enabled, avoid dlsym pthread_create on
boot.
|
| |
|
|
|
| |
Looking at the thread counts in our services, jemalloc's background thread
is useful, but mostly idle. Add a config option to tune down the number of threads.
|
| |
|
|
|
| |
1) make sure background thread 0 is always created; and 2) fix synchronization
between thread 0 and the control thread.
|
| |
|
|
|
|
| |
We have a buffer overrun that manifests in the case where arena indices higher
than the number of CPUs are accessed before arena indices lower than the number
of CPUs. This fixes the bug and adds a test.
|
| |
|
|
| |
Avoid relying pthread_once which creates dependency during init.
|
| |
|
|
|
| |
ctl_init sets isthreaded, which means it should be done without holding any
locks.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This prevents signals from being inadvertently delivered to background
threads.
|
| |
|
|
|
| |
If neither background_thread nor lazy_lock is in use, do not abort on dlsym
errors.
|
| | |
|
| |
|
|
| |
Avoid calling pthread_create in postfork handlers.
|
| |
|
|
|
| |
To avoid complications, avoid invoking pthread_create "internally", instead rely
on thread0 to launch new threads, and also terminating threads when asked.
|
| |
|
|
| |
Also fix a compilation error #ifndef JEMALLOC_PTHREAD_CREATE_WRAPPER.
|
| | |
|
| |
|
|
|
|
| |
Avoid holding arenas_lock and background_thread_lock when creating background
threads, because pthread_create may take internal locks, and potentially cause
deadlock with jemalloc internal locks.
|
| | |
|
| |
|
|
| |
The state initialization should be done before pthread_create.
|
| |
|
|
|
| |
Refactor bootstrapping such that dlsym() is called during the
bootstrapping phase that can tolerate reentrant allocation.
|
| | |
|
| |
|
|
|
| |
Use a separate boolean to track the enabled status, instead of leaving the
global background thread status inconsistent.
|
| |
|
|
|
|
| |
To avoid background threads sleeping forever with idle arenas, we eagerly check
background threads' sleep time after extents_dalloc, and signal the thread if
necessary.
|
| | |
|
|
|
Added opt.background_thread to enable background threads, which handles purging
currently. When enabled, decay ticks will not trigger purging (which will be
left to the background threads). We limit the max number of threads to NCPUs.
When percpu arena is enabled, set CPU affinity for the background threads as
well.
The sleep interval of background threads is dynamic and determined by computing
number of pages to purge in the future (based on backlog).
|