Magellan Linux

Contents of /trunk/glibc/patches/glibc-2.15-arena.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1806 - (show annotations) (download)
Tue Jun 12 12:33:27 2012 UTC (11 years, 10 months ago) by niro
File size: 1097 byte(s)
-added patches for 2.15-r1
1 diff --git a/malloc/arena.c b/malloc/arena.c
2 index d3cf4b9..b1c9469 100644
3 --- a/malloc/arena.c
4 +++ b/malloc/arena.c
5 @@ -828,7 +828,7 @@ arena_get2(mstate a_tsd, size_t size)
6 {
7 if (mp_.arena_max != 0)
8 narenas_limit = mp_.arena_max;
9 - else
10 + else if (narenas > mp_.arena_test)
11 {
12 int n = __get_nprocs ();
13
14 @@ -842,7 +842,14 @@ arena_get2(mstate a_tsd, size_t size)
15 }
16 repeat:;
17 size_t n = narenas;
18 - if (__builtin_expect (n <= mp_.arena_test || n < narenas_limit, 0))
19 + /* NB: the following depends on the fact that (size_t)0 - 1 is a
20 + very large number and that the underflow is OK. If arena_max
21 + is set the value of arena_test is irrelevant. If arena_test
22 + is set but narenas is not yet larger or equal to arena_test
23 + narenas_limit is 0. There is no possibility for narenas to
24 + be too big for the test to always fail since there is not
25 + enough address space to create that many arenas. */
26 + if (__builtin_expect (n <= narenas_limit - 1, 0))
27 {
28 if (catomic_compare_and_exchange_bool_acq (&narenas, n + 1, n))
29 goto repeat;