diff options
author | jasone <jasone@FreeBSD.org> | 1999-07-06 00:25:38 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 1999-07-06 00:25:38 +0000 |
commit | 88983e2fa584a0ccd018f2290d087e4db4c46350 (patch) | |
tree | 5873b217a3af72b58fdc75e5018708c367072b2d /lib/libpthread | |
parent | ebc43c4f80bf19d60c03df54244e9f97ea409baa (diff) | |
download | FreeBSD-src-88983e2fa584a0ccd018f2290d087e4db4c46350.zip FreeBSD-src-88983e2fa584a0ccd018f2290d087e4db4c46350.tar.gz |
Always use growable thread stacks on the i386. The VM_STACK kernel option
must be made default for the alpha before growable thread stacks are
enabled for the alpha.
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/Makefile | 5 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_create.c | 6 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_gc.c | 8 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_init.c | 6 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_private.h | 24 |
5 files changed, 18 insertions, 31 deletions
diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index e5211d9..eddc4ba 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.16 1999/07/05 00:35:14 jasone Exp $ +# $Id: Makefile,v 1.17 1999/07/05 00:38:12 jasone Exp $ # # All library objects contain rcsid strings by default; they may be # excluded as a space-saving measure. To produce a library that does @@ -15,9 +15,6 @@ CFLAGS+=-DPTHREAD_KERNEL -D_THREAD_SAFE -I${.CURDIR}/uthread # thread locking. CFLAGS+=-D_LOCK_DEBUG -# Uncomment this if you want libc_r to use growable stacks. -#CFLAGS+=-D_PTHREAD_GSTACK - AINC= -I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/uthread PRECIOUSLIB= yes diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c index 1b12c7b..f5631a5 100644 --- a/lib/libpthread/thread/thr_create.c +++ b/lib/libpthread/thread/thr_create.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_create.c,v 1.13 1999/06/20 08:28:14 jb Exp $ + * $Id: uthread_create.c,v 1.14 1999/07/05 00:35:17 jasone Exp $ */ #include <errno.h> #include <stdlib.h> @@ -37,10 +37,8 @@ #include <fcntl.h> #include <unistd.h> #include <sys/time.h> -#ifdef _PTHREAD_GSTACK #include <sys/types.h> #include <sys/mman.h> -#endif #ifdef _THREAD_SAFE #include <machine/reg.h> #include <pthread.h> @@ -81,7 +79,7 @@ pthread_create(pthread_t * thread, const pthread_attr_t * attr, /* Check if a stack was specified in the thread attributes: */ if ((stack = pattr->stackaddr_attr) != NULL) { } -#ifdef _PTHREAD_GSTACK +#ifdef __i386__ /* Allocate memory for a default-size stack: */ else if (pattr->stacksize_attr == PTHREAD_STACK_DEFAULT) { struct stack * spare_stack; diff --git a/lib/libpthread/thread/thr_gc.c b/lib/libpthread/thread/thr_gc.c index a8e05ea..6b504d9 100644 --- a/lib/libpthread/thread/thr_gc.c +++ b/lib/libpthread/thread/thr_gc.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_gc.c,v 1.4 1999/06/20 08:28:25 jb Exp $ + * $Id: uthread_gc.c,v 1.5 1999/07/05 00:35:18 jasone Exp $ * * Garbage collector thread. Frees memory allocated for dead threads. * @@ -38,10 +38,8 @@ #include <time.h> #include <unistd.h> #include <sys/types.h> -#ifdef _PTHREAD_GSTACK #include <sys/types.h> #include <sys/mman.h> -#endif #include <pthread.h> #include "pthread_private.h" @@ -136,7 +134,7 @@ _thread_gc(pthread_addr_t arg) */ if (pthread->attr.stackaddr_attr == NULL && pthread->stack != NULL) { -#ifdef _PTHREAD_GSTACK +#ifdef __i386__ if (pthread->attr.stacksize_attr == PTHREAD_STACK_DEFAULT) { /* Default-size stack. Cache it: */ struct stack * spare_stack = (pthread->stack + PTHREAD_STACK_DEFAULT @@ -172,7 +170,7 @@ _thread_gc(pthread_addr_t arg) */ if (pthread->attr.stackaddr_attr == NULL && pthread->stack != NULL) { -#ifdef _PTHREAD_GSTACK +#ifdef __i386__ if (pthread->attr.stacksize_attr == PTHREAD_STACK_DEFAULT) { /* Default-size stack. Cache it: */ struct stack * spare_stack = (pthread->stack + PTHREAD_STACK_DEFAULT diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c index 9528e00..a5b7a82 100644 --- a/lib/libpthread/thread/thr_init.c +++ b/lib/libpthread/thread/thr_init.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_init.c,v 1.12 1999/06/23 15:01:21 dt Exp $ + * $Id: uthread_init.c,v 1.13 1999/07/05 00:35:19 jasone Exp $ */ /* Allocate space for global thread variables here: */ @@ -45,10 +45,8 @@ #include <sys/sysctl.h> #include <sys/time.h> #include <sys/ttycom.h> -#ifdef _PTHREAD_GSTACK #include <sys/types.h> #include <sys/mman.h> -#endif #ifdef _THREAD_SAFE #include <machine/reg.h> #include <pthread.h> @@ -182,7 +180,7 @@ _thread_init(void) /* Initialize the scheduling switch hook routine: */ _sched_switch_hook = NULL; -#ifdef _PTHREAD_GSTACK +#ifdef __i386__ /* Initialize the thread stack cache: */ SLIST_INIT(&_stackq); diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h index 1da2151..513d81e 100644 --- a/lib/libpthread/thread/thr_private.h +++ b/lib/libpthread/thread/thr_private.h @@ -31,7 +31,7 @@ * * Private thread definitions for the uthread kernel. * - * $Id: pthread_private.h,v 1.20 1999/06/20 08:28:08 jb Exp $ + * $Id: pthread_private.h,v 1.21 1999/07/05 00:35:17 jasone Exp $ */ #ifndef _PTHREAD_PRIVATE_H @@ -335,23 +335,23 @@ struct pthread_attr { * Miscellaneous definitions. */ #define PTHREAD_STACK_DEFAULT 65536 -#ifdef _PTHREAD_GSTACK /* Size of red zone at the end of each stack. */ #define PTHREAD_STACK_GUARD 4096 /* Maximum size of initial thread's stack. This perhaps deserves to be larger - * than the stacks of other threads, since legacy applications are likely to run + * than the stacks of other threads, since many applications are likely to run * almost entirely on this stack. */ #define PTHREAD_STACK_INITIAL 0x100000 /* Address immediately beyond the beginning of the initial thread stack. */ #if defined(__FreeBSD__) -# if defined(__alpha__) -# define PTHREAD_STACK_TOP 0x160022000 -# else -# define PTHREAD_STACK_TOP 0xbfbde000 -# endif +# if defined(__i386__) +# define PTHREAD_STACK_TOP 0xbfbde000 +# elif defined(__alpha__) +# define PTHREAD_STACK_TOP 0x160022000 +# else +# error "Don't recognize this architecture!" +# endif #else -# error "Don't recognize this operating system!" -#endif +# error "Don't recognize this operating system!" #endif #define PTHREAD_DEFAULT_PRIORITY 64 #define PTHREAD_MAX_PRIORITY 126 @@ -673,12 +673,10 @@ struct pthread { int lineno; /* Source line number. */ }; -#ifdef _PTHREAD_GSTACK /* Spare thread stack. */ struct stack { SLIST_ENTRY(stack) qe; /* Queue entry for this stack. */ }; -#endif /* * Global variables for the uthread kernel. @@ -889,7 +887,6 @@ SCLASS pthread_switch_routine_t _sched_switch_hook #endif ; -#ifdef _PTHREAD_GSTACK /* Spare stack queue. Stacks of default size are cached in order to reduce * thread creation time. Spare stacks are used in LIFO order to increase cache * locality. */ @@ -905,7 +902,6 @@ SCLASS void * _next_stack = (void *) PTHREAD_STACK_TOP - PTHREAD_STACK_INITIAL - PTHREAD_STACK_DEFAULT - (2 * PTHREAD_STACK_GUARD) #endif ; -#endif /* Used for _PTHREADS_INVARIANTS checking. */ SCLASS int _thread_kern_new_state |