This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.15-130-g41b8189


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  41b81892f11fe1353123e892158b53de73863d62 (commit)
      from  6c1eace5df647ea85c7472c3fb314665abb22ec1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=41b81892f11fe1353123e892158b53de73863d62

commit 41b81892f11fe1353123e892158b53de73863d62
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Tue Jan 31 14:42:34 2012 -0500

    Handle ARENA_TEST correctly

diff --git a/ChangeLog b/ChangeLog
index f33cf83..e62d483 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-31  Ulrich Drepper  <drepper@gmail.com>
+
+	* malloc/arena.c (arena_get2): Really don't call __get_nprocs if
+	ARENA_TEST says not to.  Simplify test for creation of a new arena.
+	Partially based on a patch by Siddhesh Poyarekar <siddhesh@redhat.com>.
+
 2012-01-30  Ulrich Drepper  <drepper@gmail.com>
 
 	* elf/dl-tls.c (__tls_get_addr): Optimize by transforming all calls
diff --git a/malloc/arena.c b/malloc/arena.c
index d3cf4b9..b1c9469 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 ();
 
@@ -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;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    6 ++++++
 malloc/arena.c |   11 +++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]