summaryrefslogtreecommitdiffstats
path: root/src/background_thread.c
Commit message (Collapse)AuthorAgeFilesLines
* Set isthreaded manually.devQi Wang2017-10-061-5/+6
| | | | Avoid relying pthread_once which creates dependency during init.
* Delay background_thread_ctl_init to right before thread creation.Qi Wang2017-10-061-3/+0
| | | | | ctl_init sets isthreaded, which means it should be done without holding any locks.
* Fix pthread_sigmask() usage to block all signals.Qi Wang2017-06-261-1/+1
|
* Check arena in current context in pre_reentrancy.Qi Wang2017-06-231-3/+3
|
* Add thread name for background threads.Qi Wang2017-06-231-1/+3
|
* Mask signals during background thread creation.Jason Evans2017-06-211-3/+35
| | | | | This prevents signals from being inadvertently delivered to background threads.
* Only abort on dlsym when necessary.Qi Wang2017-06-141-3/+11
| | | | | If neither background_thread nor lazy_lock is in use, do not abort on dlsym errors.
* Combine background_thread started / paused into state.Qi Wang2017-06-121-25/+46
|
* Not re-enable background thread after fork.Qi Wang2017-06-121-35/+46
| | | | Avoid calling pthread_create in postfork handlers.
* Move background thread creation to background_thread_0.Qi Wang2017-06-121-140/+241
| | | | | To avoid complications, avoid invoking pthread_create "internally", instead rely on thread0 to launch new threads, and also terminating threads when asked.
* Normalize background thread configuration.Jason Evans2017-06-091-0/+2
| | | | Also fix a compilation error #ifndef JEMALLOC_PTHREAD_CREATE_WRAPPER.
* Add internal tsd for background_thread.Qi Wang2017-06-081-5/+4
|
* Drop high rank locks when creating threads.Qi Wang2017-06-081-1/+4
| | | | | | 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.
* Set isthreaded when enabling background_thread.Qi Wang2017-06-021-23/+39
|
* Fix background thread creation.Qi Wang2017-06-011-13/+17
| | | | The state initialization should be done before pthread_create.
* Refactor/fix background_thread/percpu_arena bootstrapping.Jason Evans2017-06-011-50/+66
| | | | | Refactor bootstrapping such that dlsym() is called during the bootstrapping phase that can tolerate reentrant allocation.
* Use real pthread_create for creating background threads.Qi Wang2017-05-311-2/+8
|
* Track background thread status separately at fork.Qi Wang2017-05-311-3/+8
| | | | | Use a separate boolean to track the enabled status, instead of leaving the global background thread status inconsistent.
* Check for background thread inactivity on extents_dalloc.Qi Wang2017-05-231-19/+42
| | | | | | 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.
* Add background thread related stats.Qi Wang2017-05-231-20/+79
|
* Implementing opt.background_thread.Qi Wang2017-05-231-0/+572
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).