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 siddhesh/mmap-fallback created. glibc-2.22-125-gdb8629e


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, siddhesh/mmap-fallback has been created
        at  db8629e263caface76d0989979937ef09654e96f (commit)

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

commit db8629e263caface76d0989979937ef09654e96f
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Mon Aug 24 13:02:30 2015 +0530

    Don't fall back to mmap if the original arena is not corrupt
    
    The new logic to find an uncontended non-corrupt arena misses a case
    where the current arena is contended, but is not corrupt.  In the
    degenerate case, this is the only arena.  In both cases, the logic
    falls back to using mmap despite there being an available arena.
    
    Attached patch by Josef Bacik makes sure that all arenas are indeed
    corrupt before falling back to malloc.  Verified on x86_64 that the
    testsuite does not regress.
    
    	* malloc/arena.c (reused_arena): return NULL only if all
    	arenas are corrupt.

diff --git a/malloc/arena.c b/malloc/arena.c
index b44e307..060eb95 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -816,23 +816,28 @@ reused_arena (mstate avoid_arena)
     }
   while (result != next_to_use);
 
-  /* Avoid AVOID_ARENA as we have already failed to allocate memory
-     in that arena and it is currently locked.   */
+  /* Avoid AVOID_ARENA as we have already failed to allocate memory in that
+     arena.  We may however end up with AVOID_ARENA once again if it is
+     the only arena available.  */
   if (result == avoid_arena)
     result = result->next;
 
   /* Make sure that the arena we get is not corrupted.  */
   mstate begin = result;
+  bool looped = false;
+
   while (arena_is_corrupt (result) || result == avoid_arena)
     {
       result = result->next;
       if (result == begin)
-	break;
+	{
+	  looped = true;
+	  break;
+	}
     }
 
-  /* We could not find any arena that was either not corrupted or not the one
-     we wanted to avoid.  */
-  if (result == begin || result == avoid_arena)
+  /* We could not find any arena that was not corrupted.  */
+  if (looped)
     return NULL;
 
   /* No arena available without contention.  Wait for the next in line.  */

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


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]