History log of /external/jemalloc/src/chunk.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
12141150fdbda57651a53ae2fe0edaea4891d814 16-May-2014 Jason Evans <je@fb.com> Refactor huge allocation to be managed by arenas.

Refactor huge allocation to be managed by arenas (though the global
red-black tree of huge allocations remains for lookup during
deallocation). This is the logical conclusion of recent changes that 1)
made per arena dss precedence apply to huge allocation, and 2) made it
possible to replace the per arena chunk allocation/deallocation
functions.

Remove the top level huge stats, and replace them with per arena huge
stats.

Normalize function names and types to *dalloc* (some were *dealloc*).

Remove the --enable-mremap option. As jemalloc currently operates, this
is a performace regression for some applications, but planned work to
logarithmically space huge size classes should provide similar amortized
performance. The motivation for this change was that mremap-based huge
reallocation forced leaky abstractions that prevented refactoring.
/external/jemalloc/src/chunk.c
59113bcc94b9fc7549611afb99ca99cad1a7f196 06-May-2014 aravind <aravind@fb.com> Add support for user-specified chunk allocators/deallocators.

Add new mallctl endpoints "arena<i>.chunk.alloc" and
"arena<i>.chunk.dealloc" to allow userspace to configure
jemalloc's chunk allocator and deallocator on a per-arena
basis.
/external/jemalloc/src/chunk.c
bd87b01999416ec7418ff8bdb504d9b6c009ff68 16-Apr-2014 Jason Evans <je@fb.com> Optimize Valgrind integration.

Forcefully disable tcache if running inside Valgrind, and remove
Valgrind calls in tcache-specific code.

Restructure Valgrind-related code to move most Valgrind calls out of the
fast path functions.

Take advantage of static knowledge to elide some branches in
JEMALLOC_VALGRIND_REALLOC().
/external/jemalloc/src/chunk.c
4d434adb146375ad17f0d5e994ed5728d2942e3f 15-Apr-2014 Jason Evans <je@fb.com> Make dss non-optional, and fix an "arena.<i>.dss" mallctl bug.

Make dss non-optional on all platforms which support sbrk(2).

Fix the "arena.<i>.dss" mallctl to return an error if "primary" or
"secondary" precedence is specified, but sbrk(2) is not supported.
/external/jemalloc/src/chunk.c
b954bc5d3a65966df0ce7801cd6102542b5e894b 03-Jan-2014 Jason Evans <je@fb.com> Convert rtree from (void *) to (uint8_t) storage.

Reduce rtree memory usage by storing booleans (1 byte each) rather than
pointers. The rtree code is only used to record whether jemalloc manages
a chunk of memory, so there's no need to store pointers in the rtree.

Increase rtree node size to 64 KiB in order to reduce tree depth from 13
to 3 on 64-bit systems. The conversion to more compact leaf nodes was
enough by itself to make the rtree depth 1 on 32-bit systems; due to the
fact that root nodes are smaller than the specified node size if
possible, the node size change has no impact on 32-bit systems (assuming
default chunk size).
/external/jemalloc/src/chunk.c
b980cc774a9ccb208a82f4e9ccdcc695d06a960a 03-Jan-2014 Jason Evans <je@fb.com> Add rtree unit tests.
/external/jemalloc/src/chunk.c
f1c3da8b02489b7728d4275ac011336299eace62 21-Oct-2013 Jason Evans <je@fb.com> Consistently use malloc_mutex_prefork().

Consistently use malloc_mutex_prefork() instead of malloc_mutex_lock()
in all prefork functions.
/external/jemalloc/src/chunk.c
d504477935151ed7befb77930f3ca64fa4d4102b 21-Oct-2013 Jason Evans <jasone@canonware.com> Fix a compiler warning.

Fix a compiler warning in chunk_record() that was due to reading node
rather than xnode. In practice this did not cause any correctness
issue, but dataflow analysis in some compilers cannot tell that node and
xnode are always equal in cases that the read is reached.
/external/jemalloc/src/chunk.c
4f929aa94853ecd7da2791f462d1b972ee66db8e 23-Apr-2013 Jason Evans <jasone@canonware.com> Fix another deadlock related to chunk_record().

Fix chunk_record() to unlock chunks_mtx before deallocating a base
node, in order to avoid potential deadlock. This fix addresses the
second of two similar bugs.
/external/jemalloc/src/chunk.c
741fbc6ba4499da39dd7d0c067c859fa52f1023f 17-Apr-2013 Jason Evans <je@fb.com> Fix deadlock related to chunk_record().

Fix chunk_record() to unlock chunks_mtx before deallocating a base node,
in order to avoid potential deadlock.

Reported by Tudor Bosman.
/external/jemalloc/src/chunk.c
06912756cccd0064a9c5c59992dbac1cec68ba3f 01-Feb-2013 Jason Evans <je@fb.com> Fix Valgrind integration.

Fix Valgrind integration to annotate all internally allocated memory in
a way that keeps Valgrind happy about internal data structure access.
/external/jemalloc/src/chunk.c
a7a28c334e5526ba716bf6046eab8d60598183eb 01-Feb-2013 Jason Evans <je@fb.com> Fix a chunk recycling bug.

Fix a chunk recycling bug that could cause the allocator to lose track
of whether a chunk was zeroed. On FreeBSD, NetBSD, and OS X, it could
cause corruption if allocating via sbrk(2) (unlikely unless running with
the "dss:primary" option specified). This was completely harmless on
Linux unless using mlockall(2) (and unlikely even then, unless the
--disable-munmap configure option or the "dss:primary" option was
specified). This regression was introduced in 3.1.0 by the
mlockall(2)/madvise(2) interaction fix.
/external/jemalloc/src/chunk.c
14a2c6a698a207ac3f3825443cf3441c8842e990 22-Jan-2013 Jason Evans <jasone@canonware.com> Avoid validating freshly mapped memory.

Move validation of supposedly zeroed pages from chunk_alloc() to
chunk_recycle(). There is little point to validating newly mapped
memory returned by chunk_alloc_mmap(), and memory that comes from sbrk()
is explicitly zeroed, so there is little risk to assuming that
chunk_alloc_dss() actually does the zeroing properly.

This relaxation of validation can make a big difference to application
startup time and overall system usage on platforms that use jemalloc as
the system allocator (namely FreeBSD).

Submitted by Ian Lepore <ian@FreeBSD.org>.
/external/jemalloc/src/chunk.c
1271185b87fcf54afb37dc05e7e0c58e5fb8f06a 12-Dec-2012 Jason Evans <jasone@canonware.com> Fix chunk_recycle() Valgrind integration.

Fix chunk_recycyle() to unconditionally inform Valgrind that returned
memory is undefined. This fixes Valgrind warnings that would result
from a huge allocation being freed, then recycled for use as an arena
chunk. The arena code would write metadata to the chunk header, and
Valgrind would consider these invalid writes.
/external/jemalloc/src/chunk.c
12efefb1953062795f5a971c1a72706787c7895c 17-Oct-2012 Jason Evans <je@fb.com> Fix dss/mmap allocation precedence code.

Fix dss/mmap allocation precedence code to use recyclable mmap memory
only after primary dss allocation fails.
/external/jemalloc/src/chunk.c
609ae595f0358157b19311b0f9f9591db7cee705 11-Oct-2012 Jason Evans <je@fb.com> Add arena-specific and selective dss allocation.

Add the "arenas.extend" mallctl, so that it is possible to create new
arenas that are outside the set that jemalloc automatically multiplexes
threads onto.

Add the ALLOCM_ARENA() flag for {,r,d}allocm(), so that it is possible
to explicitly allocate from a particular arena.

Add the "opt.dss" mallctl, which controls the default precedence of dss
allocation relative to mmap allocation.

Add the "arena.<i>.dss" mallctl, which makes it possible to set the
default dss precedence on a per arena or global basis.

Add the "arena.<i>.purge" mallctl, which obsoletes "arenas.purge".

Add the "stats.arenas.<i>.dss" mallctl.
/external/jemalloc/src/chunk.c
20f1fc95adb35ea63dc61f47f2b0ffbd37d39f32 09-Oct-2012 Jason Evans <je@fb.com> Fix fork(2)-related deadlocks.

Add a library constructor for jemalloc that initializes the allocator.
This fixes a race that could occur if threads were created by the main
thread prior to any memory allocation, followed by fork(2), and then
memory allocation in the child process.

Fix the prefork/postfork functions to acquire/release the ctl, prof, and
rtree mutexes. This fixes various fork() child process deadlocks, but
one possible deadlock remains (intentionally) unaddressed: prof
backtracing can acquire runtime library mutexes, so deadlock is still
possible if heap profiling is enabled during fork(). This deadlock is
known to be a real issue in at least the case of libgcc-based
backtracing.

Reported by tfengjun.
/external/jemalloc/src/chunk.c
7de92767c20cb72c94609b9c78985526fb84a679 09-Oct-2012 Jason Evans <je@fb.com> Fix mlockall()/madvise() interaction.

mlockall(2) can cause purging via madvise(2) to fail. Fix purging code
to check whether madvise() succeeded, and base zeroed page metadata on
the result.

Reported by Olivier Lecomte.
/external/jemalloc/src/chunk.c
374d26a43bcceb12eb56ed7cc47815d7f933901c 09-May-2012 Jason Evans <je@fb.com> Fix chunk_recycle() to stop leaking trailing chunks.

Fix chunk_recycle() to correctly compute trailsize and re-insert
trailing chunks. This fixes a major virtual memory leak.

Simplify chunk_record() to avoid dropping/re-acquiring chunks_mtx.
/external/jemalloc/src/chunk.c
de6fbdb72c6e1401b36f8f2073404645bac6cd2b 09-May-2012 Jason Evans <je@fb.com> Fix chunk_alloc_mmap() bugs.

Simplify chunk_alloc_mmap() to no longer attempt map extension. The
extra complexity isn't warranted, because although in the success case
it saves one system call as compared to immediately falling back to
chunk_alloc_mmap_slow(), it also makes the failure case even more
expensive. This simplification removes two bugs:

- For Windows platforms, pages_unmap() wasn't being called for unaligned
mappings prior to falling back to chunk_alloc_mmap_slow(). This
caused permanent virtual memory leaks.
- For non-Windows platforms, alignment greater than chunksize caused
pages_map() to be called with size 0 when attempting map extension.
This always resulted in an mmap() error, and subsequent fallback to
chunk_alloc_mmap_slow().
/external/jemalloc/src/chunk.c
34a8cf6c4029c09e1db776b7027a9c1b31f9e5b4 03-May-2012 Jason Evans <je@fb.com> Fix a base allocator deadlock.

Fix a base allocator deadlock due to chunk_recycle() calling back into
the base allocator.
/external/jemalloc/src/chunk.c
f54166e7ef5313c3b5c773cbb0ca2af95f5a15ae 24-Apr-2012 Jason Evans <je@fb.com> Add missing Valgrind annotations.
/external/jemalloc/src/chunk.c
a8f8d7540d66ddee7337db80c92890916e1063ca 22-Apr-2012 Jason Evans <jasone@canonware.com> Remove mmap_unaligned.

Remove mmap_unaligned, which was used to heuristically decide whether to
optimistically call mmap() in such a way that could reduce the total
number of system calls. If I remember correctly, the intention of
mmap_unaligned was to avoid always executing the slow path in the
presence of ASLR. However, that reasoning seems to have been based on a
flawed understanding of how ASLR actually works. Although ASLR
apparently causes mmap() to ignore address requests, it does not cause
total placement randomness, so there is a reasonable expectation that
iterative mmap() calls will start returning chunk-aligned mappings once
the first chunk has been properly aligned.
/external/jemalloc/src/chunk.c
7ad54c1c30e0805e0758690115875f982de46cf2 22-Apr-2012 Jason Evans <jasone@canonware.com> Fix chunk allocation/deallocation bugs.

Fix chunk_alloc_dss() to zero memory when requested.

Fix chunk_dealloc() to avoid chunk_dealloc_mmap() for dss-allocated
memory.

Fix huge_palloc() to always junk fill when requested.

Improve chunk_recycle() to report that memory is zeroed as a side effect
of pages_purge().
/external/jemalloc/src/chunk.c
8f0e0eb1c01d5d934586ea62e519ca8b8637aebc 21-Apr-2012 Jason Evans <jasone@canonware.com> Fix a memory corruption bug in chunk_alloc_dss().

Fix a memory corruption bug in chunk_alloc_dss() that was due to
claiming newly allocated memory is zeroed.

Reverse order of preference between mmap() and sbrk() to prefer mmap().

Clean up management of 'zero' parameter in chunk_alloc*().
/external/jemalloc/src/chunk.c
666c5bf7a8baaa842da69cb402948411432a9d00 18-Apr-2012 Mike Hommey <mh@glandium.org> Add a pages_purge function to wrap madvise(JEMALLOC_MADV_PURGE) calls

This will be used to implement the feature on mingw, which doesn't have
madvise.
/external/jemalloc/src/chunk.c
7ca0fdfb85b2a9fc7a112e158892c098e004385b 13-Apr-2012 Jason Evans <je@fb.com> Disable munmap() if it causes VM map holes.

Add a configure test to determine whether common mmap()/munmap()
patterns cause VM map holes, and only use munmap() to discard unused
chunks if the problem does not exist.

Unify the chunk caching for mmap and dss.

Fix options processing to limit lg_chunk to be large enough that
redzones will always fit.
/external/jemalloc/src/chunk.c
a1ee7838e14b321a97bfacb1f1cf5004198f2203 11-Apr-2012 Jason Evans <je@fb.com> Rename labels.

Rename labels from FOO to label_foo in order to avoid system macro
definitions, in particular OUT and ERROR on mingw.

Reported by Mike Hommey.
/external/jemalloc/src/chunk.c
eae269036c9f702d9fa9be497a1a2aa1be13a29e 10-Apr-2012 Mike Hommey <mh@glandium.org> Add alignment support to chunk_alloc().
/external/jemalloc/src/chunk.c
ae4c7b4b4092906c641d69b4bf9fcb4a7d50790d 02-Apr-2012 Jason Evans <jasone@canonware.com> Clean up *PAGE* macros.

s/PAGE_SHIFT/LG_PAGE/g and s/PAGE_SIZE/PAGE/g.

Remove remnants of the dynamic-page-shift code.

Rename the "arenas.pagesize" mallctl to "arenas.page".

Remove the "arenas.chunksize" mallctl, which is redundant with
"opt.lg_chunk".
/external/jemalloc/src/chunk.c
cd9a1346e96f71bdecdc654ea50fc62d76371e74 22-Mar-2012 Jason Evans <je@fb.com> Implement tsd.

Implement tsd, which is a TLS/TSD abstraction that uses one or both
internally. Modify bootstrapping such that no tsd's are utilized until
allocation is safe.

Remove malloc_[v]tprintf(), and use malloc_snprintf() instead.

Fix %p argument size handling in malloc_vsnprintf().

Fix a long-standing statistics-related bug in the "thread.arena"
mallctl that could cause crashes due to linked list corruption.
/external/jemalloc/src/chunk.c
4162627757889ea999264c2ddbc3c354768774e2 13-Feb-2012 Jason Evans <je@fb.com> Remove the swap feature.

Remove the swap feature, which enabled per application swap files. In
practice this feature has not proven itself useful to users.
/external/jemalloc/src/chunk.c
7372b15a31c63ac5cb9ed8aeabc2a0a3c005e8bf 11-Feb-2012 Jason Evans <je@fb.com> Reduce cpp conditional logic complexity.

Convert configuration-related cpp conditional logic to use static
constant variables, e.g.:

#ifdef JEMALLOC_DEBUG
[...]
#endif

becomes:

if (config_debug) {
[...]
}

The advantage is clearer, more concise code. The main disadvantage is
that data structures no longer have conditionally defined fields, so
they pay the cost of all fields regardless of whether they are used. In
practice, this is only a minor concern; config_stats will go away in an
upcoming change, and config_prof is the only other major feature that
depends on more than a few special-purpose fields.
/external/jemalloc/src/chunk.c
12a488782681cbd740a5f54e0b7e74ea84858e21 11-Nov-2011 Jason Evans <je@fb.com> Fix huge_ralloc to maintain chunk statistics.

Fix huge_ralloc() to properly maintain chunk statistics when using
mremap(2).
/external/jemalloc/src/chunk.c
7427525c28d58c423a68930160e3b0fe577fe953 01-Apr-2011 Jason Evans <jasone@canonware.com> Move repo contents in jemalloc/ to top level.
/external/jemalloc/src/chunk.c