Blame SOURCES/glibc-rh740506-2.patch

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