Use upstream variant of fix for 740506.

This commit is contained in:
Jeff Law 2012-02-01 09:32:10 -07:00
parent 70c5758f43
commit 7b27d27fa9
2 changed files with 28 additions and 20 deletions

View File

@ -3,8 +3,14 @@
* malloc/malloc.c (mALLOPt): Clamp arena_test based on
the value of arena_max.
commit 41b81892f11fe1353123e892158b53de73863d62
Author: Ulrich Drepper <drepper@gmail.com>
Date: Tue Jan 31 14:42:34 2012 -0500
Handle ARENA_TEST correctly
diff --git a/malloc/arena.c b/malloc/arena.c
index cb8548b..00f1da5 100644
index d3cf4b9..b1c9469 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
@ -16,20 +22,19 @@ index cb8548b..00f1da5 100644
{
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;
}
@@ -842,7 +842,14 @@ arena_get2(mstate a_tsd, size_t size)
}
repeat:;
size_t n = narenas;
- if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
+ /* NB: the following depends on the fact that (size_t)0 - 1 is a
+ very large number and that the underflow is OK. If arena_max
+ is set the value of arena_test is irrelevant. If arena_test
+ is set but narenas is not yet larger or equal to arena_test
+ narenas_limit is 0. There is no possibility for narenas to
+ be too big for the test to always fail since there is not
+ enough address space to create that many arenas. */
+ if (__builtin_expect (n <= narenas_limit - 1, 0))
{
if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
goto repeat;

View File

@ -28,7 +28,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 7%{?dist}
Release: 8%{?dist}
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@ -47,7 +47,7 @@ Patch2: %{name}-ia64-lib64.patch
# thread A has unlocked on the error path
# There's an alternate approach using mmap after detecting an error that needs discussion
Patch3: %{name}-rh757881.patch
# Sent upstream, awaiting responses
# From upstream.
Patch4: %{name}-rh740506.patch
# Not sure of upstream status
Patch5: %{name}-rh730856.patch
@ -1152,6 +1152,9 @@ rm -f *.filelist*
%endif
%changelog
* Wed Feb 1 2012 Jeff Law <law@redhat.com> - 2.15-8
- Use upstream variant of fix for 740506.
* Sun Jan 29 2012 Jeff Law <law@redhat.com> - 2.15-7
- Sort objects before relocations (sw#13618)
- Fix bogus sort code that was copied from dl-deps.c.