summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Avoid setting zero and commit if split fails in extent_recycle.Qi Wang2017-11-201-14/+10
|
* Eagerly coalesce large extents.Qi Wang2017-11-161-1/+15
| | | | | | Coalescing is a small price to pay for large allocations since they happen less frequently. This reduces fragmentation while also potentially improving locality.
* Fix an extent coalesce bug.Qi Wang2017-11-162-7/+18
| | | | | When coalescing, we should take both extents off the LRU list; otherwise decay can grab the existing outer extent through extents_evict.
* Add opt.lg_extent_max_active_fitQi Wang2017-11-167-3/+44
| | | | | | | | | | When allocating from dirty extents (which we always prefer if available), large active extents can get split even if the new allocation is much smaller, in which case the introduced fragmentation causes high long term damage. This new option controls the threshold to reuse and split an existing active extent. We avoid using a large extent for much smaller sizes, in order to reduce fragmentation. In some workload, adding the threshold improves virtual memory usage by >10x.
* Use extent_heap_first for best fit.Qi Wang2017-11-161-1/+1
| | | | | extent_heap_any makes the layout less predictable and as a result incurs more fragmentation.
* Use tsd offset_state instead of atomicDave Watson2017-11-143-3/+22
| | | | | | While working on #852, I noticed the prng state is atomic. This is the only atomic use of prng in all of jemalloc. Instead, use a threadlocal prng state if possible to avoid unnecessary cache line contention.
* Fix base allocator THP auto mode locking and stats.Qi Wang2017-11-102-21/+18
| | | | | Added proper synchronization for switching to using THP in auto mode. Also fixed stats for number of THPs used.
* Fix unbounded increase in stash_decayed.Qi Wang2017-11-093-15/+23
| | | | | | 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.
* Use hugepage alignment for base allocator.Qi Wang2017-11-041-2/+2
| | | | | This gives us an easier way to tell if the allocation is for metadata in the extent hooks.
* Add arena.i.retain_grow_limitQi Wang2017-11-038-5/+146
| | | | | | | 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.
* Try to use sysctl(3) instead of sysctlbyname(3).Edward Tomasz Napierala2017-11-031-0/+13
| | | | | | | | | This attempts to use VM_OVERCOMMIT OID - newly introduced in -CURRENT few days ago, specifically for this purpose - instead of querying the sysctl by its string name. Due to how syctlbyname(3) works, this means we do one syscall during binary startup instead of two. Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
* Use getpagesize(3) under FreeBSD.Edward Tomasz Napierala2017-11-031-0/+2
| | | | | | | This avoids sysctl(2) syscall during binary startup, using the value passed in the ELF aux vector instead. Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
* metadata_thp: auto mode adjustment for a0.Qi Wang2017-11-012-19/+31
| | | | | | 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.
* Output all counters for bin mutex stats.Qi Wang2017-10-191-4/+7
| | | | The saved space is not worth the trouble of missing counters.
* Add a "dumpable" bit to the extent state.David Goldblatt2017-10-166-21/+65
| | | | | 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-162-0/+25
| | | | This will, eventually, enable us to avoid dumping eden regions.
* Add configure-time detection for madvise(..., MADV_DO[NT]DUMP)David Goldblatt2017-10-162-0/+16
|
* Factor out extent-splitting core from extent lifetime management.David Goldblatt2017-10-161-81/+149
| | | | | | | Before this commit, extent_recycle_split intermingles the splitting of an extent and the return of parts of that extent to a given extents_t. After it, that logic is separated. This will enable splitting extents that don't live in any extents_t (as the grow retained region soon will).
* Document some of the internal extent functions.David Goldblatt2017-10-161-0/+35
|
* Fix MSVC 2015 project and add a VS 2017 solutionrustyx2017-10-1614-10/+870
|
* Remove the default value for JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS.Qi Wang2017-10-111-2/+2
|
* Define MADV_FREE on our own when needed.Qi Wang2017-10-114-1/+23
| | | | | | 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.
* Document the potential issues about opt.background_thread.Qi Wang2017-10-111-3/+6
|
* 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-062-4/+6
| | | | | ctl_init sets isthreaded, which means it should be done without holding any locks.
* Enable a0 metadata thp on the 3rd base block.Qi Wang2017-10-051-21/+64
| | | | | | Since we allocate rtree nodes from a0's base, it's pushed to over 1 block on initialization right away, which makes the auto thp mode less effective on a0. We change a0 to make the switch on the 3rd block instead.
* Power: disable the CPU_SPINWAIT macro.David Goldblatt2017-10-054-6/+18
| | | | | | | | | | | | | | 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-043-17/+14
| | | | | | | | | | 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-033-70/+61
| | | | 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.
* Add runtime detection of lazy purging support.Qi Wang2017-09-271-0/+24
| | | | | | It's possible to build with lazy purge enabled but depoly to systems without such support. In this case, rely on the boot time detection instead of keep making unnecessary madvise calls (which all returns EINVAL).
* 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.
* dumpbin doesn't exist in mingwTamir Duberstein2017-09-211-1/+7
|
* Allow toolchain to determine nmTamir Duberstein2017-09-211-1/+6
|
* whitespaceTamir Duberstein2017-09-211-7/+7
|
* Put static keyword first.Qi Wang2017-09-211-1/+1
| | | | Fix a warning by -Wold-style-declaration.
* Add missing field in initializer for rtree cache.Qi Wang2017-09-211-1/+1
| | | | Fix a warning by -Wmissing-field-initializers.
* Force Ubuntu "precise" for Travis CI builds.David Goldblatt2017-09-201-0/+1
| | | | | | | | We've been seeing strange errors in jemalloc_cpp.cpp since Travis upgraded from precise to trusty as their default CI environment (seeming to stem from some the new clang version finding the headers for an old version of libstdc++. In the long run we'll have to deal with this "for real", but at that point we may have a better C++ story in general, making it a moot point.
* Clear cache bin ql postfork.Qi Wang2017-09-121-0/+7
| | | | | This fixes a regression in 9c05490, which introduced the new cache bin ql. The list needs to be cleaned up after fork, same as tcache_ql.
* Fix huge page test in test/unit/pages.Qi Wang2017-09-121-5/+7
| | | | | Huge pages could be disabled even if the kernel header has MAD_HUGEPAGE defined. Guard the huge pagetest with runtime detection.
* Fix a link for dirty_decay_ms in manual.Qi Wang2017-09-111-1/+1
|
* Relax constraints on reentrancy for extent hooks.Qi Wang2017-08-312-1/+13
| | | | | | 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-3010-21/+125
| | | | Report number of THPs used in arena and aggregated stats.
* Change opt.metadata_thp to [disabled,auto,always].Qi Wang2017-08-3010-25/+84
| | | | | | | | 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-175-17/+84
| | | | | | 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-1711-139/+148
| | | | | | 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 missing mallctl unit test for abort_conf.Qi Wang2017-08-121-0/+1
| | | | The abort_conf option was missed from test/unit/mallctl.
* 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).