summaryrefslogtreecommitdiffstats
path: root/src/prof.c
Commit message (Collapse)AuthorAgeFilesLines
* Validates fd before calling fcntlY. T. Chung2017-07-221-1/+3
|
* Fall back to FD_CLOEXEC when O_CLOEXEC is unavailable.Y. T. Chung2017-07-201-0/+6
| | | | | | | Older Linux systems don't have O_CLOEXEC. If that's the case, we fcntl immediately after open, to minimize the length of the racy period in which an operation in another thread can leak a file descriptor to a child.
* Check arena in current context in pre_reentrancy.Qi Wang2017-06-231-1/+1
|
* Header refactoring: Pull size helpers out of jemalloc module.David Goldblatt2017-05-311-4/+4
|
* Pass the O_CLOEXEC flag to open(2).Jason Evans2017-05-311-1/+1
| | | | This resolves #528.
* Header refactoring: unify and de-catchall mutex moduleDavid Goldblatt2017-05-241-0/+1
|
* Allow mutexes to take a lock ordering enum at construction.David Goldblatt2017-05-191-11/+14
| | | | | | | 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").
* Stop depending on JEMALLOC_N() for function interception during testing.Jason Evans2017-05-121-22/+5
| | | | | | Instead, always define function pointers for interceptable functions, but mark them const unless testing, so that the compiler can optimize out the pointer dereferences.
* Header refactoring: tsd - cleanup and dependency breaking.David Goldblatt2017-05-011-5/+5
| | | | | | | | | | | | This removes the tsd macros (which are used only for tsd_t in real builds). We break up the circular dependencies involving tsd. We also move all tsd access through getters and setters. This allows us to assert that we only touch data when tsd is in a valid state. We simplify the usages of the x macro trick, removing all the customizability (get/set, init, cleanup), moving the lifetime logic to tsd_init and tsd_cleanup. This lets us make initialization order independent of order within tsd_t.
* Avoid prof_dump during reentrancy.Qi Wang2017-04-251-12/+20
|
* Header refactoring: hash - unify and remove from catchall.David Goldblatt2017-04-251-0/+1
|
* Header refactoring: ckh module - remove from the catchall and unify.David Goldblatt2017-04-241-0/+1
|
* Get rid of most of the various inline macros.David Goldblatt2017-04-241-6/+6
|
* Header refactoring: move assert.h out of the catch-allDavid Goldblatt2017-04-191-0/+1
|
* Header refactoring: move malloc_io.h out of the catchallDavid Goldblatt2017-04-191-0/+2
|
* Remove the function alignment of prof_backtrace.Qi Wang2017-04-171-1/+0
| | | | | This was an attempt to avoid triggering slow path in libunwind, however turns out to be ineffective.
* Improve rtree cache with a two-level cache design.Qi Wang2017-04-171-0/+1
| | | | | | | | Two levels of rcache is implemented: a direct mapped cache as L1, combined with a LRU cache as L2. The L1 cache offers low cost on cache hit, but could suffer collision under circumstances. This is complemented by the L2 LRU cache, which is slower on cache access (overhead from linear search + reordering), but solves collison of L1 rather well.
* Pass alloc_ctx down profiling path.Qi Wang2017-04-121-1/+1
| | | | | | With this change, when profiling is enabled, we avoid doing redundant rtree lookups. Also changed dalloc_atx_t to alloc_atx_t, as it's now used on allocation path as well (to speed up profiling).
* Header refactoring: Split up jemalloc_internal.hDavid Goldblatt2017-04-111-1/+3
| | | | | | | | | | | | | | 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.
* Pass dealloc_ctx down free() fast path.Qi Wang2017-04-111-11/+14
| | | | This gets rid of the redundent rtree lookup down fast path.
* Add hooking functionalityDavid Goldblatt2017-04-071-0/+7
| | | | | This allows us to hook chosen functions and do interesting things there (in particular: reentrancy checking).
* Make prof's cum_gctx a C11-style atomicDavid Goldblatt2017-04-051-2/+2
|
* Convert accumbytes in prof_accum_t to C11 atomics, when possibleDavid Goldblatt2017-04-051-1/+3
|
* Added lock profiling and output for global locks (ctl, prof and base).Qi Wang2017-03-231-1/+2
|
* Push down iealloc() calls.Jason Evans2017-03-231-3/+3
| | | | | Call iealloc() as deep into call chains as possible without causing redundant calls.
* Remove extent dereferences from the deallocation fast paths.Jason Evans2017-03-231-21/+12
|
* Convert arena->prof_accumbytes synchronization to atomics.Jason Evans2017-02-161-0/+14
|
* Call prof_gctx_create() without owing bt2gctx_mtx.Jason Evans2017-02-021-12/+29
| | | | | | | This reduces the probability of allocating (and thereby indirectly making a system call) while owning bt2gctx_mtx. Unfortunately it is an incomplete solution, because ckh insertion/deletion can also allocate/deallocate, which requires more extensive changes to address.
* Conditionalize prof fork handling on config_prof.Jason Evans2017-02-021-4/+4
| | | | This allows the compiler to completely remove dead code.
* Replace tabs following #define with spaces.Jason Evans2017-01-211-9/+9
| | | | This resolves #564.
* Remove extraneous parens around return arguments.Jason Evans2017-01-211-105/+105
| | | | This resolves #540.
* Update brace style.Jason Evans2017-01-211-281/+287
| | | | | | | Add braces around single-line blocks, and remove line breaks before function-opening braces. This resolves #537.
* Fix prof_realloc() regression.Jason Evans2017-01-171-40/+123
| | | | | | | | | | | | | | Mostly revert the prof_realloc() changes in 498856f44a30b31fe713a18eb2fc7c6ecf3a9f63 (Move slabs out of chunks.) so that prof_free_sampled_object() is called when appropriate. Leave the prof_tctx_[re]set() optimization in place, but add an assertion to verify that all eight cases are correctly handled. Add a comment to make clear the code ordering, so that the regression originally fixed by ea8d97b8978a0c0423f0ed64332463a25b787c3d (Fix prof_{malloc,free}_sample_object() call order in prof_realloc().) is not repeated. This resolves #499.
* Remove leading blank lines from function bodies.Jason Evans2017-01-131-29/+0
| | | | This resolves #535.
* Implement per arena base allocators.Jason Evans2016-12-271-2/+4
| | | | | | | | | | | | | Add/rename related mallctls: - Add stats.arenas.<i>.base . - Rename stats.arenas.<i>.metadata to stats.arenas.<i>.internal . - Add stats.arenas.<i>.resident . Modify the arenas.extend mallctl to take an optional (extent_hooks_t *) argument so that it is possible for all base allocations to be serviced by the specified extent hooks. This resolves #463.
* Refactor prng to not use 64-bit atomics on 32-bit platforms.Jason Evans2016-11-071-1/+1
| | | | This resolves #495.
* Do not (recursively) allocate within tsd_fetch().Jason Evans2016-10-211-45/+44
| | | | | | | Refactor tsd so that tsdn_fetch() does not trigger allocation, since allocation could cause infinite recursion. This resolves #458.
* Implement cache-oblivious support for huge size classes.Jason Evans2016-06-031-1/+1
|
* Refactor rtree to always use base_alloc() for node allocation.Jason Evans2016-06-031-14/+16
|
* Use rtree-based chunk lookups rather than pointer bit twiddling.Jason Evans2016-06-031-13/+19
| | | | | | | | | | | Look up chunk metadata via the radix tree, rather than using CHUNK_ADDR2BASE(). Propagate pointer's containing extent. Minimize extent lookups by doing a single lookup (e.g. in free()) and propagating the pointer's extent into nearly all the functions that may need it.
* Resolve bootstrapping issues when embedded in FreeBSD libc.Jason Evans2016-05-111-235/+240
| | | | | | | | | | | | | b2c0d6322d2307458ae2b28545f8a5c9903d7ef5 (Add witness, a simple online locking validator.) caused a broad propagation of tsd throughout the internal API, but tsd_fetch() was designed to fail prior to tsd bootstrapping. Fix this by splitting tsd_t into non-nullable tsd_t and nullable tsdn_t, and modifying all internal APIs that do not critically rely on tsd to take nullable pointers. Furthermore, add the tsd_booted_get() function so that tsdn_fetch() can probe whether tsd bootstrapping is complete and return NULL if not. All dangerous conversions of nullable pointers are tsdn_tsd() calls that assert-fail on invalid conversion.
* Scale leak report summary according to sampling probability.Jason Evans2016-05-041-18/+38
| | | | | | | This makes the numbers reported in the leak report summary closely match those reported by jeprof. This resolves #356.
* Fix huge_palloc() regression.Jason Evans2016-05-041-1/+1
| | | | | | | | | | Split arena_choose() into arena_[i]choose() and use arena_ichoose() for arena lookup during internal allocation. This fixes huge_palloc() so that it always succeeds during extent node allocation. This regression was introduced by 66cd953514a18477eb49732e40d5c2ab5f1b12c5 (Do not allocate metadata via non-auto arenas, nor tcaches.).
* Fix fork()-related lock rank ordering reversals.Jason Evans2016-04-261-16/+36
|
* Do not allocate metadata via non-auto arenas, nor tcaches.Jason Evans2016-04-221-24/+18
| | | | | This assures that all internally allocated metadata come from the first opt_narenas arenas, i.e. the automatically multiplexed arenas.
* Add witness, a simple online locking validator.Jason Evans2016-04-141-212/+277
| | | | This resolves #358.
* Silence miscellaneous 64-to-32-bit data loss warnings.Jason Evans2016-02-261-1/+1
| | | | This resolves #341.
* Silence miscellaneous 64-to-32-bit data loss warnings.Jason Evans2016-02-241-1/+1
|
* Fix Windows-specific prof-related compilation portability issues.Jason Evans2016-02-211-3/+16
|
* getpid() fix for Win32rustyx2016-02-201-0/+2
|