Blame SOURCES/glibc-rh740506-2.patch

4999bf
	* malloc/arena.c (arena_get2): Avoid unnecessarily
4999bf
	retrieving #cpus from /proc.
4999bf
	* malloc/malloc.c (mALLOPt): Clamp arena_test based on
4999bf
	the value of arena_max.
4999bf
4999bf
diff --git a/malloc/arena.c b/malloc/arena.c
4999bf
index cb8548b..00f1da5 100644
4999bf
--- a/malloc/arena.c
4999bf
+++ b/malloc/arena.c
4999bf
@@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
4999bf
 	{
4999bf
 	  if (mp_.arena_max != 0)
4999bf
 	    narenas_limit = mp_.arena_max;
4999bf
-	  else
4999bf
+	  else if (narenas > mp_.arena_test)
4999bf
 	    {
4999bf
 	      int n  = __get_nprocs ();
4999bf
 
4999bf
diff --git a/malloc/malloc.c b/malloc/malloc.c
4999bf
index 8608083..f8d32da 100644
4999bf
--- a/malloc/malloc.c
4999bf
+++ b/malloc/malloc.c
4999bf
@@ -6134,6 +6134,12 @@ int mALLOPt(param_number, value) int par
4999bf
     break;
4999bf
 #endif
4999bf
   }
4999bf
+#ifdef PER_THREAD
4999bf
+  /* Clamp ARENA_TEST from ARENA_MAX to avoid creating too many
4999bf
+     arenas.  */
4999bf
+  if (mp_.arena_max > 0 && mp_.arena_max <= mp_.arena_test)
4999bf
+    mp_.arena_test = mp_.arena_max - 1;
4999bf
+#endif
4999bf
   (void)mutex_unlock(&av->mutex);
4999bf
   return res;
4999bf
 }