forked from rpms/glibc
25912eaa88
- Fix typo in recent tzfile change (#769476) - Make MALLOC_ARENA_MAX and MALLOC_ARENA_TEST match documentation (#740506) - Revert "fix" to pthread_cond_wait (#769421) - Extract patch for 730856 from fedora-patch into a distinct patchfile
36 lines
975 B
Diff
36 lines
975 B
Diff
* malloc/arena.c (arena_get2): Avoid unnecessarily
|
|
retrieving #cpus from /proc.
|
|
* malloc/malloc.c (mALLOPt): Clamp arena_test based on
|
|
the value of arena_max.
|
|
|
|
diff --git a/malloc/arena.c b/malloc/arena.c
|
|
index cb8548b..00f1da5 100644
|
|
--- a/malloc/arena.c
|
|
+++ b/malloc/arena.c
|
|
@@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
|
|
{
|
|
if (mp_.arena_max != 0)
|
|
narenas_limit = mp_.arena_max;
|
|
- else
|
|
+ else if (narenas > mp_.arena_test)
|
|
{
|
|
int n = __get_nprocs ();
|
|
|
|
diff --git a/malloc/malloc.c b/malloc/malloc.c
|
|
index 8608083..f8d32da 100644
|
|
--- a/malloc/malloc.c
|
|
+++ b/malloc/malloc.c
|
|
@@ -4842,6 +4842,12 @@ int mALLOPt(int param_number, int value)
|
|
break;
|
|
#endif
|
|
}
|
|
+#ifdef PER_THREAD
|
|
+ /* Clamp ARENA_TEST from ARENA_MAX to avoid creating too many
|
|
+ arenas. */
|
|
+ if (mp_.arena_max > 0 && mp_.arena_max <= mp_.arena_test)
|
|
+ mp_.arena_test = mp_.arena_max - 1;
|
|
+#endif
|
|
(void)mutex_unlock(&av->mutex);
|
|
return res;
|
|
}
|