summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_create.c
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>1999-12-29 15:44:59 +0000
committerjasone <jasone@FreeBSD.org>1999-12-29 15:44:59 +0000
commita0b3dffc3d8f4c9f62816004946bf6c95f9f9971 (patch)
tree8ba7518bd446eaa7340253f9f0f0ebaa35117340 /lib/libpthread/thread/thr_create.c
parent383cb3575ca956c99535f199b7697e0cb3a5f5b0 (diff)
downloadFreeBSD-src-a0b3dffc3d8f4c9f62816004946bf6c95f9f9971.zip
FreeBSD-src-a0b3dffc3d8f4c9f62816004946bf6c95f9f9971.tar.gz
Don't explicitly mmap() red zones at the bottom of thread stacks (except
the initial thread). Instead, just leave an unmapped gap between thread stacks and make sure that the thread stacks won't grow into these gaps, simply by limiting the size of the stacks with the 'len' argument to mmap(). This (if I understand correctly) reduces VM overhead considerably. Reviewed by: deischen
Diffstat (limited to 'lib/libpthread/thread/thr_create.c')
-rw-r--r--lib/libpthread/thread/thr_create.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c
index a392cba..fd9e746 100644
--- a/lib/libpthread/thread/thr_create.c
+++ b/lib/libpthread/thread/thr_create.c
@@ -136,20 +136,11 @@ pthread_create(pthread_t * thread, const pthread_attr_t * attr,
if (pthread_mutex_unlock(&_gc_mutex) != 0)
PANIC("Cannot unlock gc mutex");
- /* Red zone: */
- if (mmap(stack - PTHREAD_STACK_GUARD,
- PTHREAD_STACK_GUARD, 0, MAP_ANON,
- -1, 0) == MAP_FAILED) {
- ret = EAGAIN;
- free(new_thread);
- }
/* Stack: */
- else if (mmap(stack, PTHREAD_STACK_DEFAULT,
+ if (mmap(stack, PTHREAD_STACK_DEFAULT,
PROT_READ | PROT_WRITE, MAP_STACK,
-1, 0) == MAP_FAILED) {
ret = EAGAIN;
- munmap(stack - PTHREAD_STACK_GUARD,
- PTHREAD_STACK_GUARD);
free(new_thread);
}
}
OpenPOWER on IntegriCloud