about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-08-15 22:35:53 +0000
committerUlrich Drepper <drepper@redhat.com>2008-08-15 22:35:53 +0000
commit965805e888b25d24cd5ca74b81ffdc61de6e0869 (patch)
treee785c580b64969498f3257d77d8b9956350107e3 /nptl
parent62a1ffc6faa2ff0d39b19e78fdef6f52bacb9d86 (diff)
downloadglibc-965805e888b25d24cd5ca74b81ffdc61de6e0869.tar.gz
glibc-965805e888b25d24cd5ca74b81ffdc61de6e0869.tar.xz
glibc-965805e888b25d24cd5ca74b81ffdc61de6e0869.zip
* sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Define MAP_STACK.
	* sysdeps/unix/sysv/linux/i386/bits/mman.h: Likewise.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog9
-rw-r--r--nptl/allocatestack.c22
-rw-r--r--nptl/sysdeps/x86_64/pthreaddef.h10
3 files changed, 17 insertions, 24 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0ecbce3f64..d638dde585 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,12 @@
+2008-08-15  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/x86_64/pthreaddef.h: Remove ARCH_MAP_FLAGS and
+	ARCH_RETRY_MMAP definitions.
+	* allocatestack.c: Remove definition of ARCH_MAP_FLAGS.
+	Define MAP_STACK when not defined.
+	(allocate_stack): Use MAP_STACK instead of ARCH_MAP_FLAGS.  Remove
+	handling of ARCH_RETRY_MMAP.
+
 2008-07-30  Ulrich Drepper  <drepper@redhat.com>
 
 	* tst-align2.c (f): Print message that f is reached.
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 66128e455b..9ab4d6281c 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -84,10 +84,10 @@
 #endif
 
 
-/* Let the architecture add some flags to the mmap() call used to
-   allocate stacks.  */
-#ifndef ARCH_MAP_FLAGS
-# define ARCH_MAP_FLAGS 0
+/* Newer kernels have the MAP_STACK flag to indicate a mapping is used for
+   a stack.  Use it when possible.  */
+#ifndef MAP_STACK
+# define MAP_STACK 0
 #endif
 
 /* This yields the pointer that TLS support code calls the thread pointer.  */
@@ -454,20 +454,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 #endif
 
 	  mem = mmap (NULL, size, prot,
-		      MAP_PRIVATE | MAP_ANONYMOUS | ARCH_MAP_FLAGS, -1, 0);
+		      MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
 
 	  if (__builtin_expect (mem == MAP_FAILED, 0))
 	    {
-#ifdef ARCH_RETRY_MMAP
-	      mem = ARCH_RETRY_MMAP (size, prot);
-	      if (__builtin_expect (mem == MAP_FAILED, 0))
-#endif
-		{
-		  if (errno == ENOMEM)
-		    errno = EAGAIN;
+	      if (errno == ENOMEM)
+		__set_errno (EAGAIN);
 
-		  return errno;
-		}
+	       return errno;
 	    }
 
 	  /* SIZE is guaranteed to be greater than zero.
diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
index 0195bc928f..be63a8c74a 100644
--- a/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/nptl/sysdeps/x86_64/pthreaddef.h
@@ -36,16 +36,6 @@
   ({ char *frame; asm ("movq %%rsp, %0" : "=r" (frame)); frame; })
 
 
-/* We prefer to have the stack allocated in the low 4GB since this
-   allows faster context switches.  */
-#define ARCH_MAP_FLAGS MAP_32BIT
-
-/* If it is not possible to allocate memory there retry without that
-   flag.  */
-#define ARCH_RETRY_MMAP(size, prot) \
-  mmap (NULL, size, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
-
-
 /* XXX Until we have a better place keep the definitions here.  */
 
 /* While there is no such syscall.  */