about summary refs log tree commit diff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/Makefile3
-rw-r--r--nptl/sysdeps/x86_64/pthreaddef.h11
2 files changed, 11 insertions, 3 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile b/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
index 9ecb7b092a..d3e5eb54d7 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -1,6 +1,3 @@
 ifeq ($(subdir),nptl)
 CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables
-
-# We need to make sure that stack memory is allocated in the low 4GB.
-CFLAGS-pthread_create.c += -DARCH_MAP_FLAGS=MAP_32BIT
 endif
diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
index 90a67f1751..27896a445c 100644
--- a/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/nptl/sysdeps/x86_64/pthreaddef.h
@@ -36,6 +36,17 @@
   ({ 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) \
+  mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,			      \
+	MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
+
+
 /* XXX Until we have a better place keep the definitions here.  */
 
 /* While there is no such syscall.  */