[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r2446 - in /fsf/trunk/libc: ./ elf/ posix/ sysdeps/unix/sysv/linux/bits/ sysdeps/x86_64/
- To: commits@xxxxxxxxxx
- Subject: [commits] r2446 - in /fsf/trunk/libc: ./ elf/ posix/ sysdeps/unix/sysv/linux/bits/ sysdeps/x86_64/
- From: eglibc@xxxxxxxxxx
- Date: Sat, 09 Jun 2007 07:02:55 -0000
Author: eglibc
Date: Sat Jun 9 00:02:54 2007
New Revision: 2446
Log:
Import glibc-mainline for 2007-06-09
Added:
fsf/trunk/libc/sysdeps/x86_64/sched_cpucount.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/dl-close.c
fsf/trunk/libc/elf/dl-lookup.c
fsf/trunk/libc/posix/sched_cpucount.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Jun 9 00:02:54 2007
@@ -1,3 +1,23 @@
+2007-06-08 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * elf/dl-lookup.c (_dl_lookup_symbol_x): Remove use of r_nlist.
+
+2007-06-08 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * elf/dl-close.c (_dl_close_worker): Remove all to be removed
+ libraries from the global scope at once and call THREAD_GSCOPE_WAIT
+ at most once per _dl_close_worker.
+
+2007-06-08 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/bits/sched.h: Make second parameter of
+ __sched_cpucount as const.
+ * posix/sched_cpucount.c: Adjust.
+
+ * posix/sched_cpucount.c (__sched_cpucount): Allow using special
+ instruction for counting bits.
+ * sysdeps/x86_64/sched_cpucount.c: New file.
+
2007-06-07 Ulrich Drepper <drepper@xxxxxxxxxx>
* configure.in: Avoid variable named BASH.
@@ -5,7 +25,8 @@
Patch in part by Mike Frysinger.
2007-06-06 Jakub Jelinek <jakub@xxxxxxxxxx>
- BZ #4586
+
+ [BZ #4586]
* sysdeps/i386/ldbl2mpn.c (__mpn_extract_long_double): Treat
pseudo-zeros as zero.
* sysdeps/x86_64/ldbl2mpn.c: New file.
Modified: fsf/trunk/libc/elf/dl-close.c
==============================================================================
--- fsf/trunk/libc/elf/dl-close.c (original)
+++ fsf/trunk/libc/elf/dl-close.c Sat Jun 9 00:02:54 2007
@@ -229,6 +229,7 @@
bool do_audit = GLRO(dl_naudit) > 0 && !ns->_ns_loaded->l_auditing;
#endif
bool unload_any = false;
+ unsigned int unload_global = 0;
unsigned int first_loaded = ~0;
for (unsigned int i = 0; i < nloaded; ++i)
{
@@ -292,6 +293,9 @@
/* We indeed have an object to remove. */
unload_any = true;
+
+ if (imap->l_global)
+ ++unload_global;
/* Remember where the first dynamically loaded object is. */
if (i < first_loaded)
@@ -458,6 +462,34 @@
r->r_state = RT_DELETE;
_dl_debug_state ();
+ if (unload_global)
+ {
+ /* Some objects are in the global scope list. Remove them. */
+ struct r_scope_elem *ns_msl = ns->_ns_main_searchlist;
+ unsigned int i;
+ unsigned int j = 0;
+ unsigned int cnt = ns_msl->r_nlist;
+
+ while (cnt > 0 && ns_msl->r_list[cnt - 1]->l_removed)
+ --cnt;
+
+ if (cnt + unload_global == ns_msl->r_nlist)
+ /* Speed up removing most recently added objects. */
+ j = cnt;
+ else
+ for (i = 0; i < cnt; i++)
+ if (ns_msl->r_list[i]->l_removed == 0)
+ {
+ if (i != j)
+ ns_msl->r_list[j] = ns_msl->r_list[i];
+ j++;
+ }
+ ns_msl->r_nlist = j;
+
+ if (!RTLD_SINGLE_THREAD_P)
+ THREAD_GSCOPE_WAIT ();
+ }
+
size_t tls_free_start;
size_t tls_free_end;
tls_free_start = tls_free_end = NO_TLS_OFFSET;
@@ -473,25 +505,6 @@
/* That was the last reference, and this was a dlopen-loaded
object. We can unmap it. */
- if (__builtin_expect (imap->l_global, 0))
- {
- /* This object is in the global scope list. Remove it. */
- struct r_scope_elem *ns_msl = ns->_ns_main_searchlist;
- unsigned int cnt = ns_msl->r_nlist;
-
- do
- --cnt;
- while (ns_msl->r_list[cnt] != imap);
-
- /* The object was already correctly registered. */
- while (++cnt < ns_msl->r_nlist)
- ns_msl->r_list[cnt - 1] = ns_msl->r_list[cnt];
-
- --ns_msl->r_nlist;
-
- if (!RTLD_SINGLE_THREAD_P)
- THREAD_GSCOPE_WAIT ();
- }
/* Remove the object from the dtv slotinfo array if it uses TLS. */
if (__builtin_expect (imap->l_tls_blocksize > 0, 0))
Modified: fsf/trunk/libc/elf/dl-lookup.c
==============================================================================
--- fsf/trunk/libc/elf/dl-lookup.c (original)
+++ fsf/trunk/libc/elf/dl-lookup.c Sat Jun 9 00:02:54 2007
@@ -244,13 +244,9 @@
size_t i = 0;
if (__builtin_expect (skip_map != NULL, 0))
- {
- /* Search the relevant loaded objects for a definition. */
- while ((*scope)->r_list[i] != skip_map)
- ++i;
-
- assert (i < (*scope)->r_nlist);
- }
+ /* Search the relevant loaded objects for a definition. */
+ while ((*scope)->r_list[i] != skip_map)
+ ++i;
/* Search the relevant loaded objects for a definition. */
for (size_t start = i; *scope != NULL; start = 0, ++scope)
Modified: fsf/trunk/libc/posix/sched_cpucount.c
==============================================================================
--- fsf/trunk/libc/posix/sched_cpucount.c (original)
+++ fsf/trunk/libc/posix/sched_cpucount.c Sat Jun 9 00:02:54 2007
@@ -21,31 +21,39 @@
int
-__sched_cpucount (size_t setsize, cpu_set_t *setp)
+__sched_cpucount (size_t setsize, const cpu_set_t *setp)
{
int s = 0;
- for (unsigned int j = 0; j < setsize / sizeof (__cpu_mask); ++j)
+ const __cpu_mask *p = setp->__bits;
+ const __cpu_mask *end = &setp->__bits[setsize / sizeof (__cpu_mask)];
+
+ while (p < end)
{
- __cpu_mask l = setp->__bits[j];
+ __cpu_mask l = *p++;
+
+#ifdef POPCNT
+ s += POPCNT (l);
+#else
if (l == 0)
continue;
-#if LONG_BIT > 32
+# if LONG_BIT > 32
l = (l & 0x5555555555555555ul) + ((l >> 1) & 0x5555555555555555ul);
l = (l & 0x3333333333333333ul) + ((l >> 2) & 0x3333333333333333ul);
l = (l & 0x0f0f0f0f0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0f0f0f0f0ful);
l = (l & 0x00ff00ff00ff00fful) + ((l >> 8) & 0x00ff00ff00ff00fful);
l = (l & 0x0000ffff0000fffful) + ((l >> 16) & 0x0000ffff0000fffful);
l = (l & 0x00000000fffffffful) + ((l >> 32) & 0x00000000fffffffful);
-#else
+# else
l = (l & 0x55555555ul) + ((l >> 1) & 0x55555555ul);
l = (l & 0x33333333ul) + ((l >> 2) & 0x33333333ul);
l = (l & 0x0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0ful);
l = (l & 0x00ff00fful) + ((l >> 8) & 0x00ff00fful);
l = (l & 0x0000fffful) + ((l >> 16) & 0x0000fffful);
-#endif
+# endif
s += l;
+#endif
}
return s;
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sched.h Sat Jun 9 00:02:54 2007
@@ -131,7 +131,8 @@
((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu))
# define __CPU_ISSET(cpu, cpusetp) \
(((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0)
-extern int __sched_cpucount (size_t __setsize, cpu_set_t *__setp) __THROW;
+extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
+ __THROW;
# define __CPU_COUNT(cpusetp) \
__sched_cpucount (sizeof (cpu_set_t), cpusetp)
#endif
Added: fsf/trunk/libc/sysdeps/x86_64/sched_cpucount.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/sched_cpucount.c (added)
+++ fsf/trunk/libc/sysdeps/x86_64/sched_cpucount.c Sat Jun 9 00:02:54 2007
@@ -1,0 +1,26 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef __amdfam10
+# define POPCNT(l) \
+ ({ __cpu_mask r; \
+ asm ("popcntq %1, %0" : "=r" (r) : "0" (l)); \
+ r; })
+#endif
+
+#include <posix/sched_cpucount.c>