summaryrefslogtreecommitdiffstats
path: root/src/ctl.c
Commit message (Collapse)AuthorAgeFilesLines
* Added opt_abort_conf: abort on invalid config options.Qi Wang2017-05-271-0/+3
|
* Header refactoring: unify and de-catchall mutex moduleDavid Goldblatt2017-05-241-0/+1
|
* Add profiling for the background thread mutex.Qi Wang2017-05-231-0/+12
|
* Add background thread related stats.Qi Wang2017-05-231-0/+30
|
* Implementing opt.background_thread.Qi Wang2017-05-231-3/+89
| | | | | | | | | | | 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).
* Allow mutexes to take a lock ordering enum at construction.David Goldblatt2017-05-191-1/+2
| | | | | | | This lets us specify whether and how mutexes of the same rank are allowed to be acquired. Currently, we only allow two polices (only a single mutex at a given rank at a time, and mutexes acquired in ascending order), but we can plausibly allow more (e.g. the "release uncontended mutexes before blocking").
* Refactor *decay_time into *decay_ms.Jason Evans2017-05-181-48/+47
| | | | | | | | Support millisecond resolution for decay times. Among other use cases this makes it possible to specify a short initial dirty-->muzzy decay phase, followed by a longer muzzy-->clean decay phase. This resolves #812.
* Add stats: arena uptime.Qi Wang2017-05-181-0/+8
|
* Refactor !opt.munmap to opt.retain.Jason Evans2017-04-291-3/+3
|
* Header refactoring: ctl - unify and remove from catchall.David Goldblatt2017-04-251-9/+10
| | | | | In order to do this, we introduce the mutex_prof module, which breaks a circular dependency between ctl and prof.
* Replace --disable-munmap with opt.munmap.Jason Evans2017-04-251-3/+3
| | | | | | | | | Control use of munmap(2) via a run-time option rather than a compile-time option (with the same per platform default). The old behavior of --disable-munmap can be achieved with --with-malloc-conf=munmap:false. This partially resolves #580.
* Header refactoring: size_classes module - remove from the catchallDavid Goldblatt2017-04-241-0/+1
|
* Get rid of most of the various inline macros.David Goldblatt2017-04-241-3/+3
|
* Remove --disable-tls.Jason Evans2017-04-211-3/+0
| | | | | | | This option is no longer useful, because TLS is correctly configured automatically on all supported platforms. This partially resolves #580.
* Remove --disable-tcache.Jason Evans2017-04-211-47/+19
| | | | | | | | | | | Simplify configuration by removing the --disable-tcache option, but replace the testing for that configuration with --with-malloc-conf=tcache:false. Fix the thread.arena and thread.tcache.flush mallctls to work correctly if tcache is disabled. This partially resolves #580.
* Bypass extent tracking for auto arenas.Qi Wang2017-04-211-6/+1
| | | | | | | | Tracking extents is required by arena_reset. To support this, the extent linkage was used for tracking 1) large allocations, and 2) full slabs. However modifying the extent linkage could be an expensive operation as it likely incurs cache misses. Since we forbid arena_reset on auto arenas, let's bypass the linkage operations for auto arenas.
* Header refactoring: unify nstime.h and move it out of the catch-allDavid Goldblatt2017-04-191-0/+1
|
* Header refactoring: move assert.h out of the catch-allDavid Goldblatt2017-04-191-0/+1
|
* Header refactoring: move util.h out of the catchallDavid Goldblatt2017-04-191-0/+2
|
* Prefer old/low extent_t structures during reuse.Jason Evans2017-04-171-1/+1
| | | | | | Rather than using a LIFO queue to track available extent_t structures, use a red-black tree, and always choose the oldest/lowest available during reuse.
* Header refactoring: Split up jemalloc_internal.hDavid Goldblatt2017-04-111-1/+2
| | | | | | | | | | | | | | This is a biggy. jemalloc_internal.h has been doing multiple jobs for a while now: - The source of system-wide definitions. - The catch-all include file. - The module header file for jemalloc.c This commit splits up this functionality. The system-wide definitions responsibility has moved to jemalloc_preamble.h. The catch-all include file is now jemalloc_internal_includes.h. The module headers for jemalloc.c are now in jemalloc_internal_[externs|inlines|types].h, just as they are for the other modules.
* Integrate auto tcache into TSD.Qi Wang2017-04-071-3/+3
| | | | | | | | | The embedded tcache is initialized upon tsd initialization. The avail arrays for the tbins will be allocated / deallocated accordingly during init / cleanup. With this change, the pointer to the auto tcache will always be available, as long as we have access to the TSD. tcache_available() (called in tcache_get()) is provided to check if we should use tcache.
* Profile per arena base mutex, instead of just a0.Qi Wang2017-03-231-5/+4
|
* Refactor mutex profiling code with x-macros.Qi Wang2017-03-231-118/+49
|
* Switch to nstime_t for the time related fields in mutex profiling.Qi Wang2017-03-231-2/+2
|
* Added extents_dirty / _muzzy mutexes, as well as decay_dirty / _muzzy.Qi Wang2017-03-231-33/+48
|
* Added "stats.mutexes.reset" mallctl to reset all mutex stats.Qi Wang2017-03-231-76/+128
| | | | Also switched from the term "lock" to "mutex".
* Added JSON output for lock stats.Qi Wang2017-03-231-1/+3
| | | | Also added option 'x' to malloc_stats() to bypass lock section.
* Added lock profiling and output for global locks (ctl, prof and base).Qi Wang2017-03-231-49/+97
|
* Add arena lock stats output.Qi Wang2017-03-231-8/+134
|
* Output bin lock profiling results to malloc_stats.Qi Wang2017-03-231-1/+7
| | | | | Two counters are included for the small bins: lock contention rate, and max lock waiting time.
* Implement two-phase decay-based purging.Jason Evans2017-03-151-53/+135
| | | | | | | | | | | | | | | | | | | | Split decay-based purging into two phases, the first of which uses lazy purging to convert dirty pages to "muzzy", and the second of which uses forced purging, decommit, or unmapping to convert pages to clean or destroy them altogether. Not all operating systems support lazy purging, yet the application may provide extent hooks that implement lazy purging, so care must be taken to dynamically omit the first phase when necessary. The mallctl interfaces change as follows: - opt.decay_time --> opt.{dirty,muzzy}_decay_time - arena.<i>.decay_time --> arena.<i>.{dirty,muzzy}_decay_time - arenas.decay_time --> arenas.{dirty,muzzy}_decay_time - stats.arenas.<i>.pdirty --> stats.arenas.<i>.p{dirty,muzzy} - stats.arenas.<i>.{npurge,nmadvise,purged} --> stats.arenas.<i>.{dirty,muzzy}_{npurge,nmadvise,purged} This resolves #521.
* Convert remaining arena_stats_t fields to atomicsDavid Goldblatt2017-03-141-24/+50
| | | | | | | These were all size_ts, so we have atomics support for them on all platforms, so the conversion is straightforward. Left non-atomic is curlextents, which AFAICT is not used atomically anywhere.
* Switch atomic uint64_ts in arena_stats_t to C11 atomicsDavid Goldblatt2017-03-141-20/+60
| | | | | | I expect this to be the trickiest conversion we will see, since we want atomics on 64-bit platforms, but are also always able to piggyback on some sort of external synchronization on non-64 bit platforms.
* Implement per-CPU arena.Qi Wang2017-03-091-1/+17
| | | | | | | | | | | | | | | | | | The new feature, opt.percpu_arena, determines thread-arena association dynamically based CPU id. Three modes are supported: "percpu", "phycpu" and disabled. "percpu" uses the current core id (with help from sched_getcpu()) directly as the arena index, while "phycpu" will assign threads on the same physical CPU to the same arena. In other words, "percpu" means # of arenas == # of CPUs, while "phycpu" has # of arenas == 1/2 * (# of CPUs). Note that no runtime check on whether hyper threading is enabled is added yet. When enabled, threads will be migrated between arenas when a CPU change is detected. In the current design, to reduce overhead from reading CPU id, each arena tracks the thread accessed most recently. When a new thread comes in, we will read CPU id and update arena if necessary.
* Store associated arena in tcache.Qi Wang2017-03-071-1/+1
| | | | | | This fixes tcache_flush for manual tcaches, which wasn't able to find the correct arena it associated with. Also changed the decay test to cover this case (by using manually created arenas).
* Convert arena_decay_t's time to be atomically synchronized.Jason Evans2017-03-031-1/+1
|
* Small style fix in ctl.cQi Wang2017-03-011-2/+1
|
* Convert arena->dss_prec synchronization to atomics.Jason Evans2017-02-161-2/+2
|
* Fix/refactor tcaches synchronization.Jason Evans2017-02-021-2/+0
| | | | | | | Synchronize tcaches with tcaches_mtx rather than ctl_mtx. Add missing synchronization for tcache flushing. This bug was introduced by 1cb181ed632e7573fb4eab194e4d216867222d27 (Implement explicit tcache support.), which was first released in 4.0.0.
* Replace tabs following #define with spaces.Jason Evans2017-01-211-21/+21
| | | | This resolves #564.
* Remove extraneous parens around return arguments.Jason Evans2017-01-211-72/+72
| | | | This resolves #540.
* Update brace style.Jason Evans2017-01-211-178/+166
| | | | | | | Add braces around single-line blocks, and remove line breaks before function-opening braces. This resolves #537.
* Fix --disable-stats support.Jason Evans2017-01-201-161/+195
| | | | | Fix numerous regressions that were exposed by --disable-stats, both in the core library and in the tests.
* Added stats about number of bytes cached in tcache currently.Qi Wang2017-01-181-0/+9
|
* Remove leading blank lines from function bodies.Jason Evans2017-01-131-13/+0
| | | | This resolves #535.
* Implement arena.<i>.destroy .Jason Evans2017-01-071-86/+199
| | | | | | | Add MALLCTL_ARENAS_DESTROYED for accessing destroyed arena stats as an analogue to MALLCTL_ARENAS_ALL. This resolves #382.
* Replace the arenas.initialized mallctl with arena.<i>.initialized .Jason Evans2017-01-071-29/+25
|
* Range-check mib[1] --> arena_ind casts.Jason Evans2017-01-071-7/+22
|
* Move static ctl_epoch variable into ctl_stats_t (as epoch).Jason Evans2017-01-071-4/+3
|