This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch dj/malloc updated. glibc-2.23-561-gb096a21


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, dj/malloc has been updated
       via  b096a21663259fa02087697b919f54874e8e98f4 (commit)
      from  9c879c0b3140f891ac783e009d49ff8a907fcb9a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b096a21663259fa02087697b919f54874e8e98f4

commit b096a21663259fa02087697b919f54874e8e98f4
Author: DJ Delorie <dj@delorie.com>
Date:   Thu Jul 21 15:33:27 2016 -0400

    Add various bin-related trace path flags

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 9753731..dad7921 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1192,6 +1192,13 @@ __mtb_trace_entry (uint32_t type, size_t size, void *ptr1)
   trace_ptr->path_mmap = 0;
   trace_ptr->path_munmap = 0;
   trace_ptr->path_m_f_realloc = 0;
+  trace_ptr->path_hook = 0;
+  trace_ptr->path_unsorted_add = 0;
+  trace_ptr->path_unsorted_remove = 0;
+  trace_ptr->path_unsorted_empty = 0;
+  trace_ptr->path_fastbin_add = 0;
+  trace_ptr->path_fastbin_remove = 0;
+  trace_ptr->path_malloc_consolidate = 0;
   trace_ptr->path = 0;
   trace_ptr->ptr1 = ptr1;
   trace_ptr->ptr2 = 0;
@@ -4284,6 +4291,7 @@ _int_malloc (mstate av, size_t bytes)
 		}
 	    }
 #endif
+          __MTB_TRACE_PATH(fastbin_remove);
           void *p = chunk2mem (victim);
           alloc_perturb (p, bytes);
           return p;
@@ -4415,6 +4423,7 @@ _int_malloc (mstate av, size_t bytes)
       int iters = 0;
       while ((victim = unsorted_chunks (av)->bk) != unsorted_chunks (av))
         {
+          __MTB_TRACE_PATH(unsorted_remove);
           bck = victim->bk;
           if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
               || __builtin_expect (victim->size > av->system_mem, 0))
@@ -4436,6 +4445,7 @@ _int_malloc (mstate av, size_t bytes)
               (unsigned long) (size) > (unsigned long) (nb + MINSIZE))
             {
               /* split and reattach remainder */
+	      __MTB_TRACE_PATH(unsorted_add);
               remainder_size = size - nb;
               remainder = chunk_at_offset (victim, nb);
               unsorted_chunks (av)->bk = unsorted_chunks (av)->fd = remainder;
@@ -4574,6 +4584,9 @@ _int_malloc (mstate av, size_t bytes)
           if (++iters >= MAX_ITERS)
             break;
         }
+      if (unsorted_chunks (av)->bk == unsorted_chunks (av))
+	__MTB_TRACE_PATH(unsorted_empty);
+
 
 #if USE_TCACHE
       /* If all the small chunks we found ended up cached, return one now.  */
@@ -4625,6 +4638,7 @@ _int_malloc (mstate av, size_t bytes)
                   remainder = chunk_at_offset (victim, nb);
                   /* We cannot assume the unsorted list is empty and therefore
                      have to perform a complete insert here.  */
+		  __MTB_TRACE_PATH(unsorted_add);
                   bck = unsorted_chunks (av);
                   fwd = bck->fd;
 	  if (__glibc_unlikely (fwd->bk != bck))
@@ -4737,6 +4751,7 @@ _int_malloc (mstate av, size_t bytes)
 
                   /* We cannot assume the unsorted list is empty and therefore
                      have to perform a complete insert here.  */
+		  __MTB_TRACE_PATH(unsorted_add);
                   bck = unsorted_chunks (av);
                   fwd = bck->fd;
 	  if (__glibc_unlikely (fwd->bk != bck))
@@ -4959,6 +4974,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
     fb = &fastbin (av, idx);
 
     /* Atomically link P to its fastbin: P->FD = *FB; *FB = P;  */
+    __MTB_TRACE_PATH(fastbin_add);
     mchunkptr old = *fb, old2;
     unsigned int old_idx = ~0u;
     do
@@ -5056,6 +5072,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
 	been given one chance to be used in malloc.
       */
 
+      __MTB_TRACE_PATH(unsorted_add);
       bck = unsorted_chunks(av);
       fwd = bck->fd;
       if (__glibc_unlikely (fwd->bk != bck))
@@ -5170,6 +5187,8 @@ static void malloc_consolidate(mstate av)
   mchunkptr       bck;
   mchunkptr       fwd;
 
+  __MTB_TRACE_PATH(malloc_consolidate);
+
   /*
     If max_fast is 0, we know that av hasn't
     yet been initialized, in which case do so below
@@ -5197,6 +5216,7 @@ static void malloc_consolidate(mstate av)
 	  check_inuse_chunk(av, p);
 	  nextp = p->fd;
 
+          __MTB_TRACE_PATH(fastbin_remove);
 	  /* Slightly streamlined version of consolidation code in free() */
 	  size = p->size & ~(PREV_INUSE|NON_MAIN_ARENA);
 	  nextchunk = chunk_at_offset(p, size);
@@ -5218,6 +5238,7 @@ static void malloc_consolidate(mstate av)
 	    } else
 	      clear_inuse_bit_at_offset(nextchunk, 0);
 
+	    __MTB_TRACE_PATH(unsorted_add);
 	    first_unsorted = unsorted_bin->fd;
 	    unsorted_bin->fd = p;
 	    first_unsorted->bk = p;
diff --git a/malloc/mtrace.h b/malloc/mtrace.h
index 6ce663d..b151f47 100644
--- a/malloc/mtrace.h
+++ b/malloc/mtrace.h
@@ -34,7 +34,13 @@ struct __malloc_trace_buffer_s {
   uint32_t path_munmap:1; /* munmap was called */
   uint32_t path_m_f_realloc:1; /* realloc became malloc/free (i.e. next few records) */
   uint32_t path_hook:1; /* A hook was used to complete the request */
-  uint32_t path:16; /* remaining bits */
+  uint32_t path_unsorted_add:1; /* something was added to the unsorted bin */
+  uint32_t path_unsorted_remove:1; /* something was removed from the unsorted bin */
+  uint32_t path_unsorted_empty:1; /* the unsorted bin was emptied */
+  uint32_t path_fastbin_add:1; /* something was added to a fastbin */
+  uint32_t path_fastbin_remove:1; /* something was removed from a fastbin */
+  uint32_t path_malloc_consolidate:1; /* something was removed from a fastbin */
+  uint32_t path:10; /* remaining bits */
 
   /* FREE - pointer to allocation to free.
      REALLOC - pointer to original allocation.
diff --git a/malloc/trace_dump.c b/malloc/trace_dump.c
index 7b691d9..95535cd 100644
--- a/malloc/trace_dump.c
+++ b/malloc/trace_dump.c
@@ -77,7 +77,7 @@ dump_raw_trace (unsigned char *data, long n_data)
 	default:
 	  /* Consider 'memalign' to be the largest API word we want to align
 	     on so make the name 8 chars wide at a minimum.  */
-	  printf ("%08x %8s %c%c%c%c%c%c%c%c %016llx %016llx %016llx %016llx %016llx\n",
+	  printf ("%08x %8s %c%c%c%c%c%c%c%c%c%c%c%c%c%c %016llx %016llx %016llx %016llx %016llx\n",
 		  t->thread,
 		  t->type == __MTB_TYPE_MAGIC ? "magic" : typenames[t->type],
 		  t->path_thread_cache ? 'T' : '-',
@@ -88,6 +88,12 @@ dump_raw_trace (unsigned char *data, long n_data)
 		  t->path_munmap ? 'U' : '-',
 		  t->path_m_f_realloc ? 'R' : '-',
 		  t->path_hook ? 'H' : '-',
+		  t->path_unsorted_add ? 'U' : '-',
+		  t->path_unsorted_remove ? 'u' : '-',
+		  t->path_unsorted_empty ? 'E' : '-',
+		  t->path_fastbin_add ? 'F' : '-',
+		  t->path_fastbin_remove ? 'f' : '-',
+		  t->path_malloc_consolidate ? 'C' : '-',
 		  (long long unsigned int) (size_t) t->ptr1,
 		  (long long unsigned int) t->size,
 		  (long long unsigned int) (size_t) t->ptr2,

-----------------------------------------------------------------------

Summary of changes:
 malloc/malloc.c     |   21 +++++++++++++++++++++
 malloc/mtrace.h     |    8 +++++++-
 malloc/trace_dump.c |    8 +++++++-
 3 files changed, 35 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]