aboutsummaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2017-10-17 18:25:43 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2017-10-17 18:25:43 +0100
commite4dd4ace56880d2f1064cd787e2bdb96ddacc3c4 (patch)
tree8f3fd4387a022c354f667ad126d513b28a6eb090 /malloc
parent8867c3c14b0005530d041215de8383a0fbf2c327 (diff)
downloadglibc-e4dd4ace56880d2f1064cd787e2bdb96ddacc3c4.tar
glibc-e4dd4ace56880d2f1064cd787e2bdb96ddacc3c4.tar.gz
glibc-e4dd4ace56880d2f1064cd787e2bdb96ddacc3c4.tar.bz2
glibc-e4dd4ace56880d2f1064cd787e2bdb96ddacc3c4.zip
Inline tcache functions
The functions tcache_get and tcache_put show up in profiles as they are a critical part of the tcache code. Inline them to give tcache a 16% performance gain. Since this improves multi-threaded cases as well, it helps offset any potential performance loss due to adding single-threaded fast paths. * malloc/malloc.c (tcache_put): Inline. (tcache_get): Inline.
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d3fcadd20e..302b34b67e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2921,7 +2921,7 @@ static __thread tcache_perthread_struct *tcache = NULL;
/* Caller must ensure that we know tc_idx is valid and there's room
for more chunks. */
-static void
+static __always_inline void
tcache_put (mchunkptr chunk, size_t tc_idx)
{
tcache_entry *e = (tcache_entry *) chunk2mem (chunk);
@@ -2933,7 +2933,7 @@ tcache_put (mchunkptr chunk, size_t tc_idx)
/* Caller must ensure that we know tc_idx is valid and there's
available chunks to remove. */
-static void *
+static __always_inline void *
tcache_get (size_t tc_idx)
{
tcache_entry *e = tcache->entries[tc_idx];