]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/glibc/glibc-rh740506-2.patch
toolchain: glibc: Cross build package and import patches from RHEL6.
[ipfire-2.x.git] / src / patches / glibc / glibc-rh740506-2.patch
CommitLineData
12788f63
MT
1 * malloc/arena.c (arena_get2): Avoid unnecessarily
2 retrieving #cpus from /proc.
3 * malloc/malloc.c (mALLOPt): Clamp arena_test based on
4 the value of arena_max.
5
6diff --git a/malloc/arena.c b/malloc/arena.c
7index cb8548b..00f1da5 100644
8--- a/malloc/arena.c
9+++ b/malloc/arena.c
10@@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
11 {
12 if (mp_.arena_max != 0)
13 narenas_limit = mp_.arena_max;
14- else
15+ else if (narenas > mp_.arena_test)
16 {
17 int n = __get_nprocs ();
18
19diff --git a/malloc/malloc.c b/malloc/malloc.c
20index 8608083..f8d32da 100644
21--- a/malloc/malloc.c
22+++ b/malloc/malloc.c
23@@ -6134,6 +6134,12 @@ int mALLOPt(param_number, value) int par
24 break;
25 #endif
26 }
27+#ifdef PER_THREAD
28+ /* Clamp ARENA_TEST from ARENA_MAX to avoid creating too many
29+ arenas. */
30+ if (mp_.arena_max > 0 && mp_.arena_max <= mp_.arena_test)
31+ mp_.arena_test = mp_.arena_max - 1;
32+#endif
33 (void)mutex_unlock(&av->mutex);
34 return res;
35 }