]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Inline tcache functions
authorWilco Dijkstra <wdijkstr@arm.com>
Tue, 17 Oct 2017 17:25:43 +0000 (18:25 +0100)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 16 Nov 2017 06:44:30 +0000 (12:14 +0530)
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.

(cherry-picked from commit e4dd4ace56880d2f1064cd787e2bdb96ddacc3c4)

ChangeLog
malloc/malloc.c

index e17a716e535097cc84ea5d8a799c8cfbd8d38753..192acbf7d59bfe8cbbf0b13175801fba26673f1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-17  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * malloc/malloc.c (tcache_put): Inline.
+       (tcache_get): Inline.
+
 2017-10-13  James Clarke  <jrtc27@jrtc27.com>
 
        * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela):
index 01ec1571b9319a79f142a450d38fe9b8677327e8..546579bce4a3129d6e4939ed43ee4cf2e401d268 100644 (file)
@@ -2957,7 +2957,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);
@@ -2969,7 +2969,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];