* Fri Nov 18 2011 Jeff Law <law@redhat.com> - 2.14.90-19

- Check malloc areana atomically
  - Don't call reused_arena when _int_new_arena failed (#753601)

* Wed Nov 16 2011 Jeff Law <law@redhat.com> - 2.14.90-18
  - Fix grouping and reuse other locales in various locales (BZ#13147)

* Tue Nov 15 2011 Jeff Law <law@redhat.com> - 2.14.90-17
  Revert bogus commits/rebasing of Nov 14, Nov 11 and Nov 8.  Sources
  should be equivalent to Fedora 16's initial release.

Pulled into master (f17)
This commit is contained in:
Jeff Law 2011-11-21 10:33:40 -07:00
parent a515186e36
commit 5d47a9295a
3 changed files with 1822 additions and 1 deletions

146
glibc-arenalock.patch Normal file
View File

@ -0,0 +1,146 @@
commit 77cdc054e02069d72dcf54a9ad7d7df3a24bcb01
Author: Andreas Schwab <schwab@redhat.com>
Date: Wed Nov 9 17:14:39 2011 +0100
Check malloc arana limit atomically
diff --git a/ChangeLog b/ChangeLog
index bf09161..edd7dd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-11-14 Andreas Schwab <schwab@redhat.com>
+
+ * malloc/arena.c (arena_get2): Don't call reused_arena when
+ _int_new_arena failed.
+
+2011-11-10 Andreas Schwab <schwab@redhat.com>
+
+ * malloc/arena.c (_int_new_arena): Don't increment narenas.
+ (reused_arena): Don't check arena limit.
+ (arena_get2): Atomically check arena limit.
+
2011-10-19 Andreas Schwab <schwab@redhat.com>
* sysdeps/x86_64/fpu/math_private.h (libc_feupdateenv): Use
diff --git a/malloc/arena.c b/malloc/arena.c
index 9114fd2..042cac8 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -747,8 +747,6 @@ _int_new_arena(size_t size)
main_arena.next = a;
#ifdef PER_THREAD
- ++narenas;
-
(void)mutex_unlock(&list_lock);
#endif
@@ -786,30 +784,6 @@ get_free_list (void)
static mstate
reused_arena (void)
{
- if (narenas <= mp_.arena_test)
- return NULL;
-
- static int narenas_limit;
- if (narenas_limit == 0)
- {
- if (mp_.arena_max != 0)
- narenas_limit = mp_.arena_max;
- else
- {
- int n = __get_nprocs ();
-
- if (n >= 1)
- narenas_limit = NARENAS_FROM_NCORES (n);
- else
- /* We have no information about the system. Assume two
- cores. */
- narenas_limit = NARENAS_FROM_NCORES (2);
- }
- }
-
- if (narenas < narenas_limit)
- return NULL;
-
mstate result;
static mstate next_to_use;
if (next_to_use == NULL)
@@ -844,10 +818,41 @@ arena_get2(mstate a_tsd, size_t size)
mstate a;
#ifdef PER_THREAD
- if ((a = get_free_list ()) == NULL
- && (a = reused_arena ()) == NULL)
- /* Nothing immediately available, so generate a new arena. */
- a = _int_new_arena(size);
+ static size_t narenas_limit;
+
+ a = get_free_list ();
+ if (a == NULL)
+ {
+ /* Nothing immediately available, so generate a new arena. */
+ if (narenas_limit == 0)
+ {
+ if (mp_.arena_max != 0)
+ narenas_limit = mp_.arena_max;
+ else
+ {
+ int n = __get_nprocs ();
+
+ if (n >= 1)
+ narenas_limit = NARENAS_FROM_NCORES (n);
+ else
+ /* We have no information about the system. Assume two
+ cores. */
+ narenas_limit = NARENAS_FROM_NCORES (2);
+ }
+ }
+ repeat:;
+ size_t n = narenas;
+ if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
+ {
+ if (catomic_compare_and_exchange_bool_acq(&narenas, n + 1, n))
+ goto repeat;
+ a = _int_new_arena (size);
+ if (__builtin_expect (a != NULL, 1))
+ return a;
+ catomic_decrement(&narenas);
+ }
+ a = reused_arena ();
+ }
#else
if(!a_tsd)
a = a_tsd = &main_arena;
commit a5fb313cb7b7e692fd4684916aaa98e03ec7e8b6
Author: Andreas Schwab <schwab@redhat.com>
Date: Mon Nov 14 11:41:52 2011 +0100
Don't call reused_arena when _int_new_arena failed
diff --git a/malloc/arena.c b/malloc/arena.c
index 042cac8..cb8548b 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -844,14 +844,14 @@ arena_get2(mstate a_tsd, size_t size)
size_t n = narenas;
if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
{
- if (catomic_compare_and_exchange_bool_acq(&narenas, n + 1, n))
+ if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
goto repeat;
a = _int_new_arena (size);
- if (__builtin_expect (a != NULL, 1))
- return a;
- catomic_decrement(&narenas);
+ if (__builtin_expect (a == NULL, 0))
+ catomic_decrement (&narenas);
}
- a = reused_arena ();
+ else
+ a = reused_arena ();
}
#else
if(!a_tsd)

1660
glibc-localegrouping.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 15
Release: 19
# 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
@ -43,6 +43,8 @@ Source2: %{glibcsrcdir}-fedora.tar.xz
Patch0: %{name}-fedora.patch
Patch1: %{name}-ia64-lib64.patch
Patch2: %{name}-no-leaf-attribute.patch
Patch3: %{name}-localegrouping.patch
Patch4: %{name}-arenalock.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: glibc-profile < 2.4
Obsoletes: nss_db
@ -262,6 +264,8 @@ rm -rf %{glibcportsdir}
%endif
%endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
# A lot of programs still misuse memcpy when they have to use
# memmove. The memcpy implementation below is not tolerant at
@ -1114,6 +1118,17 @@ rm -f *.filelist*
%endif
%changelog
* Fri Nov 18 2011 Jeff Law <law@redhat.com> - 2.14.90-19
- Check malloc areana atomically
- Don't call reused_arena when _int_new_arena failed (#753601)
* Wed Nov 16 2011 Jeff Law <law@redhat.com> - 2.14.90-18
- Fix grouping and reuse other locales in various locales (BZ#13147)
* Tue Nov 15 2011 Jeff Law <law@redhat.com> - 2.14.90-17
Revert bogus commits/rebasing of Nov 14, Nov 11 and Nov 8. Sources
should be equivalent to Fedora 16's initial release.
* Wed Oct 26 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.14.90-15
- Rebuilt for glibc bug#747377