History log of /external/jemalloc/src/tsd.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
83e5767ee9a8c68150cca06ae0d27a13ba4fcaf8 22-Apr-2015 Christopher Ferris <cferris@google.com> Revert "Revert "Merge remote-tracking branch 'aosp/upstream-dev' into merge""

This reverts commit 75929a97332565c3b987986f35652b6d5d275d3c.

The original failure this was reverted for seems to have been a bug somewhere else.

Change-Id: Ib29ba03b1b967f940dc19eceac2aa1d2923be1eb
/external/jemalloc/src/tsd.c
75929a97332565c3b987986f35652b6d5d275d3c 16-Apr-2015 Nicolas Geoffray <ngeoffray@google.com> Revert "Merge remote-tracking branch 'aosp/upstream-dev' into merge"

Revert due to random ART crashes seen.

This reverts commit 5b5d97b42e84c2ac417271c3fab6fc282496a335.

Change-Id: I62a784301fded7ee853b182d172be46bb32bded7
/external/jemalloc/src/tsd.c
4581b97809e7e545c38b996870a4e7284a620bc5 27-Nov-2014 Jason Evans <je@fb.com> Implement metadata statistics.

There are three categories of metadata:

- Base allocations are used for bootstrap-sensitive internal allocator
data structures.
- Arena chunk headers comprise pages which track the states of the
non-metadata pages.
- Internal allocations differ from application-originated allocations
in that they are for internal use, and that they are omitted from heap
profiles.

The metadata statistics comprise the metadata categories as follows:

- stats.metadata: All metadata -- base + arena chunk headers + internal
allocations.
- stats.arenas.<i>.metadata.mapped: Arena chunk headers.
- stats.arenas.<i>.metadata.allocated: Internal allocations. This is
reported separately from the other metadata statistics because it
overlaps with the allocated and active statistics, whereas the other
metadata statistics do not.

Base allocations are not reported separately, though their magnitude can
be computed by subtracting the arena-specific metadata.

This resolves #163.
/external/jemalloc/src/tsd.c
10aff3f3e1b8b3ac0348b259c439c9fe870a6b95 21-Jan-2015 Jason Evans <jasone@canonware.com> Refactor bootstrapping to delay tsd initialization.

Refactor bootstrapping to delay tsd initialization, primarily to support
integration with FreeBSD's libc.

Refactor a0*() for internal-only use, and add the
bootstrap_{malloc,calloc,free}() API for use by FreeBSD's libc. This
separation limits use of the a0*() functions to metadata allocation,
which doesn't require malloc/calloc/free API compatibility.

This resolves #170.
/external/jemalloc/src/tsd.c
8bb3198f72fc7587dc93527f9f19fb5be52fa553 08-Oct-2014 Jason Evans <jasone@canonware.com> Refactor/fix arenas manipulation.

Abstract arenas access to use arena_get() (or a0get() where appropriate)
rather than directly reading e.g. arenas[ind]. Prior to the addition of
the arenas.extend mallctl, the worst possible outcome of directly
accessing arenas was a stale read, but arenas.extend may allocate and
assign a new array to arenas.

Add a tsd-based arenas_cache, which amortizes arenas reads. This
introduces some subtle bootstrapping issues, with tsd_boot() now being
split into tsd_boot[01]() to support tsd wrapper allocation
bootstrapping, as well as an arenas_cache_bypass tsd variable which
dynamically terminates allocation of arenas_cache itself.

Promote a0malloc(), a0calloc(), and a0free() to be generally useful for
internal allocation, and use them in several places (more may be
appropriate).

Abstract arena->nthreads management and fix a missing decrement during
thread destruction (recent tsd refactoring left arenas_cleanup()
unused).

Change arena_choose() to propagate OOM, and handle OOM in all callers.
This is important for providing consistent allocation behavior when the
MALLOCX_ARENA() flag is being used. Prior to this fix, it was possible
for an OOM to result in allocation silently allocating from a different
arena than the one specified.
/external/jemalloc/src/tsd.c
029d44cf8b22aa7b749747bfd585887fb59e0030 04-Oct-2014 Jason Evans <jasone@canonware.com> Fix tsd cleanup regressions.

Fix tsd cleanup regressions that were introduced in
5460aa6f6676c7f253bfcb75c028dfd38cae8aaf (Convert all tsd variables to
reside in a single tsd structure.). These regressions were twofold:

1) tsd_tryget() should never (and need never) return NULL. Rename it to
tsd_fetch() and simplify all callers.
2) tsd_*_set() must only be called when tsd is in the nominal state,
because cleanup happens during the nominal-->purgatory transition,
and re-initialization must not happen while in the purgatory state.
Add tsd_nominal() and use it as needed. Note that tsd_*{p,}_get()
can still be used as long as no re-initialization that would require
cleanup occurs. This means that e.g. the thread_allocated counter
can be updated unconditionally.
/external/jemalloc/src/tsd.c
5460aa6f6676c7f253bfcb75c028dfd38cae8aaf 23-Sep-2014 Jason Evans <jasone@canonware.com> Convert all tsd variables to reside in a single tsd structure.
/external/jemalloc/src/tsd.c
d82a5e6a34f20698ab9368bb2b4953b81d175552 13-Dec-2013 Jason Evans <jasone@canonware.com> Implement the *allocx() API.

Implement the *allocx() API, which is a successor to the *allocm() API.
The *allocx() functions are slightly simpler to use because they have
fewer parameters, they directly return the results of primary interest,
and mallocx()/rallocx() avoid the strict aliasing pitfall that
allocm()/rallocx() share with posix_memalign(). The following code
violates strict aliasing rules:

foo_t *foo;
allocm((void **)&foo, NULL, 42, 0);

whereas the following is safe:

foo_t *foo;
void *p;
allocm(&p, NULL, 42, 0);
foo = (foo_t *)p;

mallocx() does not have this problem:

foo_t *foo = (foo_t *)mallocx(42, 0);
/external/jemalloc/src/tsd.c
d6df91438a1cf25ea248c3897da463c51709c580 20-Nov-2013 Jason Evans <je@fb.com> Fix a potential infinite loop during thread exit.

Fix malloc_tsd_dalloc() to bypass tcache when dallocating, so that there
is no danger of causing tcache reincarnation during thread exit.
Whether this infinite loop occurs depends on the pthreads TSD
implementation; it is known to occur on Solaris.

Submitted by Markus Eberspächer.
/external/jemalloc/src/tsd.c
cb17fc6a8f1ce29be18de7af6d03e66056751fb2 21-Oct-2013 Leonard Crestez <lcrestez@ixiacom.com> Add support for LinuxThreads.

When using LinuxThreads pthread_setspecific triggers recursive
allocation on all threads. Work around this by creating a global linked
list of in-progress tsd initializations.

This modifies the _tsd_get_wrapper macro-generated function. When it has
to initialize an TSD object it will push the item to the linked list
first. If this causes a recursive allocation then the _get_wrapper
request is satisfied from the list. When pthread_setspecific returns the
item is removed from the list.

This effectively adds a very poor substitute for real TLS used only
during pthread_setspecific allocation recursion.

Signed-off-by: Crestez Dan Leonard <lcrestez@ixiacom.com>
/external/jemalloc/src/tsd.c
203484e2ea267e068a68fd2922263f0ff1d5ac6f 02-May-2012 Jason Evans <je@fb.com> Optimize malloc() and free() fast paths.

Embed the bin index for small page runs into the chunk page map, in
order to omit [...] in the following dependent load sequence:
ptr-->mapelm-->[run-->bin-->]bin_info

Move various non-critcal code out of the inlined function chain into
helper functions (tcache_event_hard(), arena_dalloc_small(), and
locking).
/external/jemalloc/src/tsd.c
fd97b1dfc76647c3f90f28dc63cc987041fe20df 30-Apr-2012 Mike Hommey <mh@glandium.org> Add support for MSVC

Tested with MSVC 8 32 and 64 bits.
/external/jemalloc/src/tsd.c
da99e31105eb709ef4ec8a120b115c32a6b9723a 30-Apr-2012 Mike Hommey <mh@glandium.org> Replace JEMALLOC_ATTR with various different macros when it makes sense

Theses newly added macros will be used to implement the equivalent under
MSVC. Also, move the definitions to headers, where they make more sense,
and for some, are even more useful there (e.g. malloc).
/external/jemalloc/src/tsd.c
8b49971d0ce0819af78aa2a278c26ecb298ee134 24-Apr-2012 Mike Hommey <mh@glandium.org> Avoid variable length arrays and remove declarations within code

MSVC doesn't support C99, and building as C++ to be able to use them is
dangerous, as C++ and C99 are incompatible.

Introduce a VARIABLE_ARRAY macro that either uses VLA when supported,
or alloca() otherwise. Note that using alloca() inside loops doesn't
quite work like VLAs, thus the use of VARIABLE_ARRAY there is discouraged.
It might be worth investigating ways to check whether VARIABLE_ARRAY is
used in such context at runtime in debug builds and bail out if that
happens.
/external/jemalloc/src/tsd.c
a19e87fbad020e8dd3d26682032929e8e5ae71c1 22-Apr-2012 Mike Hommey <mh@glandium.org> Add support for Mingw
/external/jemalloc/src/tsd.c
13067ec8350f213c3accc2e5fb70ca5a503e0e17 18-Apr-2012 Mike Hommey <mh@glandium.org> Remove extra argument for malloc_tsd_cleanup_register

Bookkeeping an extra argument that actually only stores a function pointer
for a function we already have is not very useful.
/external/jemalloc/src/tsd.c
86e58583bb443fcfe885a1a96b466ab5933cb443 19-Apr-2012 Jason Evans <jasone@canonware.com> Make special FreeBSD function overrides visible.

Make special FreeBSD libc/libthr function overrides for
_malloc_prefork(), _malloc_postfork(), and _malloc_thread_cleanup()
visible.
/external/jemalloc/src/tsd.c
fad100bc35efba262f2c98cefc134899d393c734 06-Apr-2012 Jason Evans <je@fb.com> Remove arena_malloc_prechosen().

Remove arena_malloc_prechosen(), now that arena_malloc() can be invoked
in a way that is semantically equivalent.
/external/jemalloc/src/tsd.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/tsd.c