Malloc improvements

Anton Blanchard anton@au1.ibm.com
Thu Jul 14 01:19:00 GMT 2016


Hi DJ,

> Fixed and pushed.  Thanks!
> 
> Time for 1B iterations:
> 
>  8.51s  dj/malloc
> 15.56s  glibc
>  9.58s  tcmalloc
> 12.09s  jemalloc

Fantastic! I verified the fix on POWER8:

baseline    473%
jemalloc    149%
dj/malloc   106%
tcmalloc    100%

I noticed a 32bit sign extension issue when using the updated trace
facility:

71128 ftruncate(3, 2080374784)          = 0
...
71128 ftruncate(3, 18446744071562067968) = -1 EINVAL (Invalid argument)

One way of fixing this is below.

Anton

--

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 70e7dc8..3b4781c 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1163,7 +1163,7 @@ __mtb_trace_entry (uint32_t type, size_t size, void *ptr1)
   my_num = TRACE_COUNT_TO_MAPPING_NUM (my_trace_count);
   if (my_num != __malloc_trace_last_num)
     {
-      int new_window;
+      long new_window;
       int new_ref_count;
 
       /* START W: Switch window.  */



More information about the Libc-alpha mailing list