summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Fix unbounded increase in stash_decayed.Qi Wang2017-11-091-1/+2
| | | | | | Added an upper bound on how many pages we can decay during the current run. Without this, decay could have unbounded increase in stashed, since other threads could add new pages into the extents.
* Add arena.i.retain_grow_limitQi Wang2017-11-033-0/+9
| | | | | | | This option controls the max size when grow_retained. This is useful when we have customized extent hooks reserving physical memory (e.g. 1G huge pages). Without this feature, the default increasing sequence could result in fragmented and wasted physical memory.
* metadata_thp: auto mode adjustment for a0.Qi Wang2017-11-011-0/+9
| | | | | | We observed that arena 0 can have much more metadata allocated comparing to other arenas. Tune the auto mode to only switch to huge page on the 5th block (instead of 3 previously) for a0.
* Add a "dumpable" bit to the extent state.David Goldblatt2017-10-162-8/+44
| | | | | Currently, this is unused (i.e. all extents are always marked dumpable). In the future, we'll begin using this functionality.
* Add pages_dontdump and pages_dodump.David Goldblatt2017-10-161-0/+2
| | | | This will, eventually, enable us to avoid dumping eden regions.
* Add configure-time detection for madvise(..., MADV_DO[NT]DUMP)David Goldblatt2017-10-161-0/+5
|
* Define MADV_FREE on our own when needed.Qi Wang2017-10-112-0/+7
| | | | | | On x86 Linux, we define our own MADV_FREE if madvise(2) is available, but no MADV_FREE is detected. This allows the feature to be built in and enabled with runtime detection.
* Power: disable the CPU_SPINWAIT macro.David Goldblatt2017-10-052-1/+13
| | | | | | | | | | | | | | Quoting from https://github.com/jemalloc/jemalloc/issues/761 : [...] reading the Power ISA documentation[1], the assembly in [the CPU_SPINWAIT macro] isn't correct anyway (as @marxin points out): the setting of the program-priority register is "sticky", and we never undo the lowering. We could do something similar, but given that we don't have testing here in the first place, I'm inclined to simply not try. I'll put something up reverting the problematic commit tomorrow. [1] Book II, chapter 3 of the 2.07B or 3.0B ISA documents.
* Use ph instead of rb tree for extents_avail_Dave Watson2017-10-042-16/+13
| | | | | | | | | | There does not seem to be any overlap between usage of extent_avail and extent_heap, so we can use the same hook. The only remaining usage of rb trees is in the profiling code, which has some 'interesting' iteration constraints. Fixes #888
* Logging: capitalize log macro.David Goldblatt2017-10-031-21/+12
| | | | Dodge a name-conflict with the math.h logarithm function. D'oh.
* ARM: Don't extend bit LG_VADDR to compute high address bits.David Goldblatt2017-10-021-0/+12
| | | | | | | In userspace ARM on Linux, zero-ing the high bits is the correct way to do this. This doesn't fix the fact that we currently set LG_VADDR to 48 on ARM, when in fact larger virtual address sizes are coming soon. We'll cross that bridge when we come to it.
* Avoid left shift by negative values.Qi Wang2017-09-251-2/+2
| | | | Fix warnings on -Wshift-negative-value.
* Add "falls through" comment explicitly.Qi Wang2017-09-251-14/+14
| | | | Fix warnings by -Wimplicit-fallthrough.
* Add missing field in initializer for rtree cache.Qi Wang2017-09-211-1/+1
| | | | Fix a warning by -Wmissing-field-initializers.
* Relax constraints on reentrancy for extent hooks.Qi Wang2017-08-311-0/+1
| | | | | | If we guarantee no malloc activity in extent hooks, it's possible to make customized hooks working on arena 0. Remove the non-a0 assertion to enable such use cases.
* Add stats for metadata_thp.Qi Wang2017-08-304-1/+5
| | | | Report number of THPs used in arena and aggregated stats.
* Change opt.metadata_thp to [disabled,auto,always].Qi Wang2017-08-303-2/+22
| | | | | | | | To avoid the high RSS caused by THP + low usage arena (i.e. THP becomes a significant percentage), added a new "auto" option which will only start using THP after a base allocator used up the first THP region. Starting from the second hugepage (in a single arena), "auto" behaves the same as "always", i.e. madvise hugepage right away.
* Document the ialloc function abbreviations.David Goldblatt2017-08-172-1/+19
| | | | | In the jemalloc_internal_inlines files, we have a lot of somewhat terse function names. This commit adds some documentation to aid in translation.
* Make arena stats collection go through cache bins.David Goldblatt2017-08-173-13/+71
| | | | | | This eliminates the need for the arena stats code to "know" about tcaches; all that it needs is a cache_bin_array_descriptor_t to tell it where to find cache_bins whose stats it should aggregate.
* Pull out caching for a bin into its own file.David Goldblatt2017-08-179-117/+126
| | | | | | This is the first step towards breaking up the tcache and arena (since they interact primarily at the bin level). It should also make a future arena caching implementation more straightforward.
* Add support for m68k, nios2, SH3 architecturesFaidon Liambotis2017-08-111-1/+8
| | | | | Add minimum alignment for three more architectures, as requested by Debian users or porters (see Debian bugs #807554, #816236, #863424).
* Fix test/unit/pages.Qi Wang2017-08-111-0/+7
| | | | | | As part of the metadata_thp support, We now have a separate swtich (JEMALLOC_HAVE_MADVISE_HUGE) for MADV_HUGEPAGE availability. Use that instead of JEMALLOC_THP (which doesn't guard pages_huge anymore) in tests.
* Implement opt.metadata_thpQi Wang2017-08-114-0/+13
| | | | | This option enables transparent huge page for base allocators (require MADV_HUGEPAGE support).
* Remove external linkage for spin_adaptiveRyan Libby2017-08-081-7/+1
| | | | | | | The external linkage for spin_adaptive was not used, and the inline declaration of spin_adaptive that was used caused a probem on FreeBSD where CPU_SPINWAIT is implemented as a call to a static procedure for x86 architectures.
* Logging: log using the log var names directly.David Goldblatt2017-07-241-2/+3
| | | | | | | | | | | Currently we have to log by writing something like: static log_var_t log_a_b_c = LOG_VAR_INIT("a.b.c"); log (log_a_b_c, "msg"); This is sort of annoying. Let's just write: log("a.b.c", "msg");
* Logging: allow logging with empty varargs.David Goldblatt2017-07-223-6/+41
| | | | | | Currently, the log macro requires at least one argument after the format string, because of the way the preprocessor handles varargs macros. We can hide some of that irritation by pushing the extra arguments into a varargs function.
* Add entry and exit logging to all core functions.David T. Goldblatt2017-07-211-0/+6
| | | | I.e. mallloc, free, the allocx API, the posix extensions.
* Add a logging facility.David T. Goldblatt2017-07-213-0/+106
| | | | | This sets up a hierarchical logging facility, so that we can add logging statements liberally, and turn them on in a fine-grained manner.
* Add extent_grow_mtx in pre_ / post_fork handlers.Qi Wang2017-06-301-0/+1
| | | | This fixed the issue that could cause the child process to stuck after fork.
* Switch ctl to explicitly use tsd instead of tsdn.Qi Wang2017-06-231-2/+1
|
* Check arena in current context in pre_reentrancy.Qi Wang2017-06-231-1/+4
|
* Set reentrancy when invoking customized extent hooks.Qi Wang2017-06-231-1/+1
| | | | | Customized extent hooks may malloc / free thus trigger reentry. Support this behavior by adding reentrancy on hook functions.
* Add thread name for background threads.Qi Wang2017-06-231-0/+3
|
* Avoid inactivity_check within background threads.Qi Wang2017-06-221-2/+3
| | | | | | Passing is_background_thread down the decay path, so that background thread itself won't attempt inactivity_check. This fixes an issue with background thread doing trylock on a mutex it already owns.
* Mask signals during background thread creation.Jason Evans2017-06-211-0/+1
| | | | | This prevents signals from being inadvertently delivered to background threads.
* Add minimal initialized TSD.Qi Wang2017-06-161-8/+22
| | | | | | | | | We use the minimal_initilized tsd (which requires no cleanup) for free() specifically, if tsd hasn't been initialized yet. Any other activity will transit the state from minimal to normal. This is to workaround the case where a thread has no malloc calls in its lifetime until during thread termination, free() happens after tls destructors.
* Pass tsd to tcache_flush().Qi Wang2017-06-161-1/+1
|
* Only abort on dlsym when necessary.Qi Wang2017-06-141-0/+1
| | | | | 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-4/+8
|
* Move background thread creation to background_thread_0.Qi Wang2017-06-122-2/+2
| | | | | 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-092-6/+5
| | | | Also fix a compilation error #ifndef JEMALLOC_PTHREAD_CREATE_WRAPPER.
* Remove redundant typedefs.Jason Evans2017-06-081-2/+0
| | | | Pre-C11 compilers do not support typedef redefinition.
* Add internal tsd for background_thread.Qi Wang2017-06-081-5/+10
|
* Drop high rank locks when creating threads.Qi Wang2017-06-081-0/+1
| | | | | | 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.
* Make tsd no-cleanup during tsd reincarnation.Qi Wang2017-06-071-1/+1
| | | | | Since tsd cleanup isn't guaranteed when reincarnated, we set up tsd in a way that needs no cleanup, by making it going through slow path instead.
* Take background thread lock when setting extent hooks.Qi Wang2017-06-051-1/+2
|
* Set isthreaded when enabling background_thread.Qi Wang2017-06-021-0/+1
|
* Refactor/fix background_thread/percpu_arena bootstrapping.Jason Evans2017-06-016-25/+41
| | | | | Refactor bootstrapping such that dlsym() is called during the bootstrapping phase that can tolerate reentrant allocation.
* Header refactoring: Pull size helpers out of jemalloc module.David Goldblatt2017-05-3112-310/+340
|
* Header refactoring: unify and de-catchall mutex_pool.David Goldblatt2017-05-315-26/+13
|