[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r20086 - in /fsf/trunk/libc: ./ malloc/ ports/ ports/sysdeps/m68k/ ports/sysdeps/unix/sysv/linux/ia64/nptl/ sysdeps/unix/sys...



Author: eglibc
Date: Sat Aug 11 00:01:40 2012
New Revision: 20086

Log:
Import glibc-mainline for 2012-08-11

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/malloc/arena.c
    fsf/trunk/libc/malloc/malloc.c
    fsf/trunk/libc/ports/ChangeLog.ia64
    fsf/trunk/libc/ports/ChangeLog.m68k
    fsf/trunk/libc/ports/sysdeps/m68k/ldsodefs.h
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sysconf.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Aug 11 00:01:40 2012
@@ -1,3 +1,28 @@
+2012-08-10  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/kernel-features.h
+	(__LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL): Define.
+	[__LINUX_KERNEL_VERSION >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL]
+	(__ASSUME_ARG_MAX_STACK_BASED): Define.
+	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf)
+	[__LINUX_KERNEL_VERSION < 0x020617]: Change condition to
+	!__ASSUME_ARG_MAX_STACK_BASED.  Compare version with
+	__LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL.
+
+2012-08-09  Jeff Law <law@xxxxxxxxxx>
+
+	[BZ #13939]
+	* malloc.c/arena.c (reused_arena): New parameter, avoid_arena.
+	When avoid_arena is set, don't retry in the that arena.  Pick the
+	next one, whatever it might be.
+	(arena_get2): New parameter avoid_arena, pass through to reused_arena.
+	(arena_lock): Pass in new parameter to arena_get2.
+	* malloc/malloc.c (__libc_memalign): Pass in new parameter to
+	arena_get2.
+	(__libc_malloc): Unify retrying after main arena failure with
+	__libc_memalign version.
+	(__libc_valloc, __libc_pvalloc, __libc_calloc): Likewise.
+
 2012-08-09  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	[BZ #14166]

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat Aug 11 00:01:40 2012
@@ -9,8 +9,8 @@
 
 * The following bugs are resolved with this release:
 
-  6778, 6808, 13717, 14042, 14166, 14150, 14151, 14154, 14157, 14173, 14283,
-  14298, 14307, 14328, 14331, 14336, 14337, 14347, 14349
+  6778, 6808, 13717, 13939, 14042, 14166, 14150, 14151, 14154, 14157, 14173,
+  14283, 14298, 14307, 14328, 14331, 14336, 14337, 14347, 14349
 
 * Support for STT_GNU_IFUNC symbols added for s390 and s390x.
   Optimized versions of memcpy, memset, and memcmp added for System z10 and

Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Sat Aug 11 00:01:40 2012
@@ -120,14 +120,14 @@
   if(ptr) \
     (void)mutex_lock(&ptr->mutex); \
   else \
-    ptr = arena_get2(ptr, (size)); \
+    ptr = arena_get2(ptr, (size), NULL); \
 } while(0)
 #else
 # define arena_lock(ptr, size) do { \
   if(ptr && !mutex_trylock(&ptr->mutex)) { \
     THREAD_STAT(++(ptr->stat_lock_direct)); \
   } else \
-    ptr = arena_get2(ptr, (size)); \
+    ptr = arena_get2(ptr, (size), NULL); \
 } while(0)
 #endif
 
@@ -778,9 +778,11 @@
   return result;
 }
 
-
+/* Lock and return an arena that can be reused for memory allocation.
+   Avoid AVOID_ARENA as we have already failed to allocate memory in
+   it and it is currently locked.  */
 static mstate
-reused_arena (void)
+reused_arena (mstate avoid_arena)
 {
   mstate result;
   static mstate next_to_use;
@@ -797,6 +799,11 @@
     }
   while (result != next_to_use);
 
+  /* Avoid AVOID_ARENA as we have already failed to allocate memory
+     in that arena and it is currently locked.   */
+  if (result == avoid_arena)
+    result = result->next;
+
   /* No arena available.  Wait for the next in line.  */
   (void)mutex_lock(&result->mutex);
 
@@ -811,7 +818,7 @@
 
 static mstate
 internal_function
-arena_get2(mstate a_tsd, size_t size)
+arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
 {
   mstate a;
 
@@ -856,7 +863,7 @@
 	    catomic_decrement (&narenas);
 	}
       else
-	a = reused_arena ();
+	a = reused_arena (avoid_arena);
     }
 #else
   if(!a_tsd)

Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Sat Aug 11 00:01:40 2012
@@ -2865,9 +2865,11 @@
       victim = _int_malloc(ar_ptr, bytes);
       (void)mutex_unlock(&ar_ptr->mutex);
     } else {
-      /* ... or sbrk() has failed and there is still a chance to mmap() */
-      ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
-      (void)mutex_unlock(&main_arena.mutex);
+      /* ... or sbrk() has failed and there is still a chance to mmap()
+	 Grab ar_ptr->next prior to releasing its lock.  */
+      mstate prev = ar_ptr->next ? ar_ptr : 0;
+      (void)mutex_unlock(&ar_ptr->mutex);
+      ar_ptr = arena_get2(prev, bytes, ar_ptr);
       if(ar_ptr) {
 	victim = _int_malloc(ar_ptr, bytes);
 	(void)mutex_unlock(&ar_ptr->mutex);
@@ -3043,10 +3045,11 @@
       p = _int_memalign(ar_ptr, alignment, bytes);
       (void)mutex_unlock(&ar_ptr->mutex);
     } else {
-      /* ... or sbrk() has failed and there is still a chance to mmap() */
+      /* ... or sbrk() has failed and there is still a chance to mmap()
+	 Grab ar_ptr->next prior to releasing its lock.  */
       mstate prev = ar_ptr->next ? ar_ptr : 0;
       (void)mutex_unlock(&ar_ptr->mutex);
-      ar_ptr = arena_get2(prev, bytes);
+      ar_ptr = arena_get2(prev, bytes, ar_ptr);
       if(ar_ptr) {
 	p = _int_memalign(ar_ptr, alignment, bytes);
 	(void)mutex_unlock(&ar_ptr->mutex);
@@ -3083,23 +3086,27 @@
   if(!ar_ptr)
     return 0;
   p = _int_valloc(ar_ptr, bytes);
-  (void)mutex_unlock(&ar_ptr->mutex);
   if(!p) {
     /* Maybe the failure is due to running out of mmapped areas. */
     if(ar_ptr != &main_arena) {
+      (void)mutex_unlock(&ar_ptr->mutex);
       ar_ptr = &main_arena;
       (void)mutex_lock(&ar_ptr->mutex);
       p = _int_memalign(ar_ptr, pagesz, bytes);
       (void)mutex_unlock(&ar_ptr->mutex);
     } else {
-      /* ... or sbrk() has failed and there is still a chance to mmap() */
-      ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0, bytes);
+      /* ... or sbrk() has failed and there is still a chance to mmap()
+	 Grab ar_ptr->next prior to releasing its lock.  */
+      mstate prev = ar_ptr->next ? ar_ptr : 0;
+      (void)mutex_unlock(&ar_ptr->mutex);
+      ar_ptr = arena_get2(prev, bytes, ar_ptr);
       if(ar_ptr) {
 	p = _int_memalign(ar_ptr, pagesz, bytes);
 	(void)mutex_unlock(&ar_ptr->mutex);
       }
     }
-  }
+  } else
+    (void)mutex_unlock (&ar_ptr->mutex);
   assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
 	 ar_ptr == arena_for_chunk(mem2chunk(p)));
 
@@ -3127,24 +3134,27 @@
 
   arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
   p = _int_pvalloc(ar_ptr, bytes);
-  (void)mutex_unlock(&ar_ptr->mutex);
   if(!p) {
     /* Maybe the failure is due to running out of mmapped areas. */
     if(ar_ptr != &main_arena) {
+      (void)mutex_unlock(&ar_ptr->mutex);
       ar_ptr = &main_arena;
       (void)mutex_lock(&ar_ptr->mutex);
       p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
       (void)mutex_unlock(&ar_ptr->mutex);
     } else {
-      /* ... or sbrk() has failed and there is still a chance to mmap() */
-      ar_ptr = arena_get2(ar_ptr->next ? ar_ptr : 0,
-			  bytes + 2*pagesz + MINSIZE);
+      /* ... or sbrk() has failed and there is still a chance to mmap()
+	 Grab ar_ptr->next prior to releasing its lock.  */
+      mstate prev = ar_ptr->next ? ar_ptr : 0;
+      (void)mutex_unlock(&ar_ptr->mutex);
+      ar_ptr = arena_get2(prev, bytes + 2*pagesz + MINSIZE, ar_ptr);
       if(ar_ptr) {
 	p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
 	(void)mutex_unlock(&ar_ptr->mutex);
       }
     }
-  }
+  } else
+    (void)mutex_unlock(&ar_ptr->mutex);
   assert(!p || chunk_is_mmapped(mem2chunk(p)) ||
 	 ar_ptr == arena_for_chunk(mem2chunk(p)));
 
@@ -3209,8 +3219,6 @@
 #endif
   mem = _int_malloc(av, sz);
 
-  /* Only clearing follows, so we can unlock early. */
-  (void)mutex_unlock(&av->mutex);
 
   assert(!mem || chunk_is_mmapped(mem2chunk(mem)) ||
 	 av == arena_for_chunk(mem2chunk(mem)));
@@ -3218,21 +3226,24 @@
   if (mem == 0) {
     /* Maybe the failure is due to running out of mmapped areas. */
     if(av != &main_arena) {
+      (void)mutex_unlock(&av->mutex);
       (void)mutex_lock(&main_arena.mutex);
       mem = _int_malloc(&main_arena, sz);
       (void)mutex_unlock(&main_arena.mutex);
     } else {
-      /* ... or sbrk() has failed and there is still a chance to mmap() */
-      (void)mutex_lock(&main_arena.mutex);
-      av = arena_get2(av->next ? av : 0, sz);
-      (void)mutex_unlock(&main_arena.mutex);
+      /* ... or sbrk() has failed and there is still a chance to mmap()
+	 Grab av->next prior to releasing its lock.  */
+      mstate prev = av->next ? av : 0;
+      (void)mutex_unlock(&av->mutex);
+      av = arena_get2(prev, sz, av);
       if(av) {
 	mem = _int_malloc(av, sz);
 	(void)mutex_unlock(&av->mutex);
       }
     }
     if (mem == 0) return 0;
-  }
+  } else
+    (void)mutex_unlock(&av->mutex);
   p = mem2chunk(mem);
 
   /* Two optional cases in which clearing not necessary */

Modified: fsf/trunk/libc/ports/ChangeLog.ia64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.ia64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.ia64 Sat Aug 11 00:01:40 2012
@@ -1,3 +1,10 @@
+2012-08-10  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h
+	(_dl_discover_osversion): Do not condition on
+	__LINUX_KERNEL_VERSION < 0x020617.
+	(HAVE_DL_DISCOVER_OSVERSION): Likewise.
+
 2012-08-03  Mike Frysinger  <vapier@xxxxxxxxxx>
 
 	[BZ #12194]

Modified: fsf/trunk/libc/ports/ChangeLog.m68k
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.m68k (original)
+++ fsf/trunk/libc/ports/ChangeLog.m68k Sat Aug 11 00:01:40 2012
@@ -1,3 +1,8 @@
+2012-08-10  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
+
+	* sysdeps/m68k/ldsodefs.h (m68k_gnu_pltenter): Remove const on
+	fifth parameter.
+
 2012-08-08  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/m68k/kernel-features.h

Modified: fsf/trunk/libc/ports/sysdeps/m68k/ldsodefs.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/m68k/ldsodefs.h (original)
+++ fsf/trunk/libc/ports/sysdeps/m68k/ldsodefs.h Sat Aug 11 00:01:40 2012
@@ -1,5 +1,5 @@
 /* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 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
@@ -26,7 +26,7 @@
 #define ARCH_PLTENTER_MEMBERS						\
     Elf32_Addr (*m68k_gnu_pltenter) (Elf32_Sym *, unsigned int,		\
 				     uintptr_t *, uintptr_t *,		\
-				     const struct La_m68k_regs *,	\
+				     struct La_m68k_regs *,		\
 				     unsigned int *, const char *name,  \
 				     long int *framesizep);
 

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/ia64/nptl/dl-sysdep.h Sat Aug 11 00:01:40 2012
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  IA-64 version.
-   Copyright (C) 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 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
@@ -65,9 +65,7 @@
 #define DL_ARGV_NOT_RELRO 1
 
 
-/* The _dl_discover_osversion function is so far only needed in sysconf
-   to check for kernels later than 2.6.23.  */
-#if !defined __ASSEMBLER__ && __LINUX_KERNEL_VERSION < 0x020617
+#ifndef __ASSEMBLER__
 /* Get version of the OS.  */
 extern int _dl_discover_osversion (void) attribute_hidden;
 # define HAVE_DL_DISCOVER_OSVERSION	1

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/kernel-features.h Sat Aug 11 00:01:40 2012
@@ -208,6 +208,13 @@
     && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
 	|| defined __sparc__ || defined __s390__)
 # define __ASSUME_O_CLOEXEC	1
+#endif
+
+/* From 2.6.23 onwards the value of ARG_MAX depends on the stack
+   size.  */
+#define __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL	0x020617
+#if __LINUX_KERNEL_VERSION >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL
+# define __ASSUME_ARG_MAX_STACK_BASED	1
 #endif
 
 /* Support for ADJ_OFFSET_SS_READ was added in 2.6.24.  */

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sysconf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sysconf.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sysconf.c Sat Aug 11 00:01:40 2012
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003,2004,2006 2008,2009,2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 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
@@ -88,11 +88,11 @@
       return HAS_CPUCLOCK (name);
 
     case _SC_ARG_MAX:
-#if __LINUX_KERNEL_VERSION < 0x020617
-      /* Determine whether this is a kernel 2.6.23 or later.  Only
-	 then do we have an argument limit determined by the stack
-	 size.  */
-      if (GLRO(dl_discover_osversion) () >= 0x020617)
+#if !__ASSUME_ARG_MAX_STACK_BASED
+      /* Determine whether this is a kernel with an argument limit
+	 determined by the stack size.  */
+      if (GLRO(dl_discover_osversion) ()
+	  >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL)
 #endif
 	/* Use getrlimit to get the stack limit.  */
 	if (__getrlimit (RLIMIT_STACK, &rlimit) == 0)

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits