This is the mail archive of the libc-alpha@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]

[PATCH v2] Don't fall back to mmap if the original arena is not corrupt


On Wed, Aug 19, 2015 at 09:50:29AM -0400, Mike Frysinger wrote:
> verified how ?

Sorry, I meant to write "verified that there were no regressions on
x86_64".  Testing this behaviour itself is tricky since you'll need to
generate the right amount of load to cause contention, with a single
arena or in a retry path.

> doesn't this comment explicitly say you don't want to use the avoid arena ?
> doesn't it need updating now with this change in logic ?

Right, updated patch with comment:

Siddhesh

diff --git a/malloc/arena.c b/malloc/arena.c
index 21ecc5a1..2430d77 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -823,16 +823,20 @@ reused_arena (mstate avoid_arena)
 
   /* 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.  */

Attachment: pgpoo2KQJdJ2A.pgp
Description: PGP signature


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