diff options
author | jasone <jasone@FreeBSD.org> | 1999-12-29 15:44:59 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 1999-12-29 15:44:59 +0000 |
commit | a0b3dffc3d8f4c9f62816004946bf6c95f9f9971 (patch) | |
tree | 8ba7518bd446eaa7340253f9f0f0ebaa35117340 /lib/libc_r/uthread/uthread_init.c | |
parent | 383cb3575ca956c99535f199b7697e0cb3a5f5b0 (diff) | |
download | FreeBSD-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/libc_r/uthread/uthread_init.c')
-rw-r--r-- | lib/libc_r/uthread/uthread_init.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_init.c b/lib/libc_r/uthread/uthread_init.c index c888697..051483f 100644 --- a/lib/libc_r/uthread/uthread_init.c +++ b/lib/libc_r/uthread/uthread_init.c @@ -186,7 +186,13 @@ _thread_init(void) /* Initialize the thread stack cache: */ SLIST_INIT(&_stackq); - /* Create the red zone for the main stack. */ + /* + * Create a red zone below the main stack. All other stacks are + * constrained to a maximum size by the paramters passed to + * mmap(), but this stack is only limited by resource limits, so + * this stack needs an explicitly mapped red zone to protect the + * thread stack that is just beyond. + */ if (mmap((void *) USRSTACK - PTHREAD_STACK_INITIAL - PTHREAD_STACK_GUARD, PTHREAD_STACK_GUARD, 0, MAP_ANON, -1, 0) == MAP_FAILED) |