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-562-g7a738e7


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  7a738e7f526e8c4f063176e79df9393355a91685 (commit)
      from  b096a21663259fa02087697b919f54874e8e98f4 (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=7a738e7f526e8c4f063176e79df9393355a91685

commit 7a738e7f526e8c4f063176e79df9393355a91685
Author: DJ Delorie <dj@delorie.com>
Date:   Fri Jul 22 01:23:10 2016 -0400

    More 32-bit fixes.
    
    Various fixes to handle traces and workloads bigger than 2 Gb.

diff --git a/malloc/trace2wl.cc b/malloc/trace2wl.cc
index e1e8bb6..d677402 100644
--- a/malloc/trace2wl.cc
+++ b/malloc/trace2wl.cc
@@ -36,8 +36,8 @@ struct Buffer {
   BufferBlock *first_buffer;
   BufferBlock *last_buffer;
 
-  int count_total;
-  int count_last;
+  size_t count_total;
+  size_t count_last;
 
   Buffer();
   void add (char x);
@@ -121,10 +121,10 @@ PerThreadMap per_thread;
 struct PerAddr {
   PerThread *owner;
   void *ptr;
-  int idx;
+  size_t idx;
   int valid;
   const char *reason;
-  int reason_idx;
+  size_t reason_idx;
   __malloc_trace_buffer_s *inverted;
   PerAddr(void *_ptr) : owner(0), ptr(_ptr), valid(0), reason("not seen"), inverted(NULL) {};
 };
@@ -187,7 +187,7 @@ int fixed_inversions = 0;
 static void
 process_one_trace_record (__malloc_trace_buffer_s *r)
 {
-  int i = r - trace_records;
+  size_t i = r - trace_records;
 
   // Quick-skip for NULs at EOF
   if (r->type == __MTB_TYPE_UNUSED)
@@ -233,11 +233,10 @@ process_one_trace_record (__malloc_trace_buffer_s *r)
 	{
 	  if (pa2->inverted)
 	    {
-	      printf ("%d: pointer %p alloc'd again? (possible multi-level inversion) size %d  %d:%s\n",
-		      i, pa2->ptr, (int)r->size, pa2->reason_idx, pa2->reason);
-	      exit (1);
+	      printf ("%ld: pointer %p alloc'd again? (possible multi-level inversion) size %ld  %ld:%s\n",
+		      i, pa2->ptr, (long int)r->size, pa2->reason_idx, pa2->reason);
+	      //	      exit (1);
 	    }
-	  printf("inversion for type %d\n", r->type);
 	  pa2->inverted = r;
 	  fixed_inversions ++;
 	  pending_inversions ++;
@@ -289,7 +288,7 @@ process_one_trace_record (__malloc_trace_buffer_s *r)
 	}
       else
 	{
-	  printf("%d: invalid pointer %p passed to free: %d:%s\n", i, pa1->ptr, pa1->reason_idx, pa1->reason);
+	  printf("%ld: invalid pointer %p passed to free: %ld:%s\n", i, pa1->ptr, pa1->reason_idx, pa1->reason);
 	}
       break;
 
@@ -322,7 +321,7 @@ process_one_trace_record (__malloc_trace_buffer_s *r)
     case __MTB_TYPE_MEMALIGN:
       acq_ptr (thread, pa2);
       if (pa2 && pa2->valid)
-	printf ("%d: pointer %p memalign'd again?  %d:%s\n", i, pa2->ptr, pa2->reason_idx, pa2->reason);
+	printf ("%ld: pointer %p memalign'd again?  %ld:%s\n", i, pa2->ptr, pa2->reason_idx, pa2->reason);
       thread->add (C_MEMALIGN);
       thread->add_int (pa2 ? pa2->idx : 0);
       thread->add_int (r->size2);
@@ -336,7 +335,7 @@ process_one_trace_record (__malloc_trace_buffer_s *r)
       break;
 
     case __MTB_TYPE_POSIX_MEMALIGN:
-      printf ("%d: Unsupported posix_memalign call.\n", i);
+      printf ("%ld: Unsupported posix_memalign call.\n", i);
       exit (1);
       break;
 
@@ -398,12 +397,12 @@ main(int argc, char **argv)
 
   per_addr[0] = NULL;
 
-  for (unsigned int i = 0; i < num_trace_records; i++)
+  for (unsigned long i = 0; i < num_trace_records; i++)
     process_one_trace_record (trace_records + i);
 
   int n_threads = per_thread.size();
   PerThread *threads[n_threads];
-  int thread_off[n_threads];
+  size_t thread_off[n_threads];
   int i = 0;
 
   PerThreadMap::iterator iter;
@@ -416,19 +415,19 @@ main(int argc, char **argv)
       threads[i++] = iter->second;
       iter->second->add(C_DONE);
       if(verbose)
-	printf("thread: %d bytes\n", iter->second->workload.count_total);
+	printf("thread: %ld bytes\n", (long)iter->second->workload.count_total);
     }
 
   /* The location of each thread's workload depends on the size of the
      startup block, but the size of the startup block depends on the
      size of the thread's location encoding.  So, we loop until it
      stabilizes.  */
-  int old_len = 1;
-  int new_len = 2;
+  size_t old_len = 1;
+  size_t new_len = 2;
   Buffer main_loop;
   while (old_len != new_len)
     {
-      int off = new_len;
+      size_t off = new_len;
       int i;
 
       old_len = new_len;
@@ -467,7 +466,7 @@ main(int argc, char **argv)
   for (i=0; i<n_threads; i++)
     {
       if (verbose)
-	printf("Start thread[%d] offset 0x%x\n", i, thread_off[i]);
+	printf("Start thread[%d] offset 0x%lx\n", i, (long)thread_off[i]);
       threads[i]->workload.write (wl_fd);
     }
 
diff --git a/malloc/trace_run.c b/malloc/trace_run.c
index 91331e4..fc9cbbd 100644
--- a/malloc/trace_run.c
+++ b/malloc/trace_run.c
@@ -1,3 +1,4 @@
+#define _LARGEFILE64_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -186,7 +187,7 @@ io_init (IOPerThreadType *io, size_t file_offset, int incr)
   io->incr = incr;
 
   pthread_mutex_lock (&io_mutex);
-  lseek (io_fd, io->buf_base, SEEK_SET);
+  lseek64 (io_fd, io->buf_base, SEEK_SET);
   // short read OK, the eof is just to prevent runaways from bad data.
   if (read (io_fd, io->buf, incr) < 0)
     io->saw_eof = 1;
@@ -278,12 +279,14 @@ thread_common (void *my_data_v)
   ticks_t my_realloc_time = 0, my_realloc_count = 0;
   ticks_t my_free_time = 0, my_free_count = 0;
   ticks_t stime, etime;
+  int thread_idx = io - thread_io;
 #ifdef MDEBUG
   volatile void *tmp;
 #endif
 
   while (1)
     {
+      unsigned char this_op = io_peek (io);
       if (io->saw_eof)
 	myabort();
       dprintf("op %p:%ld is %d\n", (void *)thrc, io_pos (io),  io_peek (io));
@@ -483,6 +486,8 @@ thread_common (void *my_data_v)
 	  break;
 
 	default:
+	  printf("op %d - unsupported, thread %d addr %lu\n",
+		 this_op, thread_idx, (long unsigned int)io_pos (io));
 	  myabort();
 	}
     }
@@ -611,7 +616,7 @@ main(int argc, char **argv)
 	  idx = get_int (&main_io);
 	  io_init (& thread_io[thread_idx], idx, guessed_io_size);
 	  pthread_create (&thread_ids[thread_idx], NULL, thread_common, thread_io + thread_idx);
-	  dprintf("Starting thread %lld at offset %d %x\n", (long long)thread_ids[thread_idx], (int)idx, (unsigned int)idx);
+	  dprintf("Starting thread %lld at offset %lu %lx\n", (long long)thread_ids[thread_idx], (unsigned long)idx, (unsigned long)idx);
 	  thread_idx ++;
 	  break;
 	case C_DONE:

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

Summary of changes:
 malloc/trace2wl.cc |   37 ++++++++++++++++++-------------------
 malloc/trace_run.c |    9 +++++++--
 2 files changed, 25 insertions(+), 21 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]