Add single-threaded path to malloc/realloc/calloc/memalloc
commit3f6bb8a32e5f5efd78ac08c41e623651cc242a89
authorWilco Dijkstra <wdijkstr@arm.com>
Tue, 24 Oct 2017 11:39:24 +0000 (24 12:39 +0100)
committerWilco Dijkstra <wdijkstr@arm.com>
Tue, 24 Oct 2017 11:39:24 +0000 (24 12:39 +0100)
tree268b445ef692deca0158cdd4832b0cc925538703
parent1d479c8c33bab8c47f66c2199a353b5459881be3
Add single-threaded path to malloc/realloc/calloc/memalloc

This patch adds a single-threaded fast path to malloc, realloc,
calloc and memalloc.  When we're single-threaded, we can bypass
arena_get (which always locks the arena it returns) and just use
the main arena.  Also avoid retrying a different arena since
there is just the main arena.

* malloc/malloc.c (__libc_malloc): Add SINGLE_THREAD_P path.
(__libc_realloc): Likewise.
(_mid_memalign): Likewise.
(__libc_calloc): Likewise.
ChangeLog
malloc/malloc.c