From 29360eb0997356045ec1bcfe29298a9e3ffb6c60 Mon Sep 17 00:00:00 2001 From: David Greenman Date: Mon, 21 Mar 1994 09:35:24 +0000 Subject: [PATCH] Changed dynamic stack grow code to grow by "SGROWSIZ" amount. Initially allocate SGROWSIZ amount of stack. Also set vm_ssize to the initial stack VM size. Increased DFLSSIZ stack rlimit default to 8MB. --- sys/amd64/amd64/vm_machdep.c | 15 +++++++-------- sys/amd64/include/vmparam.h | 7 +++++-- sys/i386/i386/vm_machdep.c | 15 +++++++-------- sys/i386/include/vmparam.h | 7 +++++-- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index b94e92f86df..72836908ca6 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -37,7 +37,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.11 1994/02/08 09:26:04 davidg Exp $ + * $Id: vm_machdep.c,v 1.12 1994/03/07 11:38:36 davidg Exp $ */ #include "npx.h" @@ -315,8 +315,7 @@ cpu_reset() { /* * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of DFLSSIZ. It is expected (required) that there is an - * integer number of DFLSSIZ chunks in MAXSSIZ. + * chunks of SGROWSIZ. */ int grow(p, sp) @@ -336,7 +335,7 @@ grow(p, sp) return (0); if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - DFLSSIZ) < nss) { + SGROWSIZ) < nss) { int grow_amount; /* * If necessary, grow the VM that the stack occupies @@ -344,13 +343,13 @@ grow(p, sp) * to allocate all of the VM up-front in execve (which * is expensive). * Grow the VM by the amount requested rounded up to - * the nearest DFLSSIZ to provide for some hysteresis. + * the nearest SGROWSIZ to provide for some hysteresis. */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), DFLSSIZ); + grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - DFLSSIZ) - grow_amount; + SGROWSIZ) - grow_amount; /* - * If there isn't enough room to extend by DFLSSIZ, then + * If there isn't enough room to extend by SGROWSIZ, then * just extend to the maximum size */ if (v < vm->vm_maxsaddr) { diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index 95d4fc93a60..df901267202 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $Id: vmparam.h,v 1.10 1994/01/03 16:00:52 davidg Exp $ + * $Id: vmparam.h,v 1.11 1994/01/14 16:24:00 davidg Exp $ */ @@ -75,11 +75,14 @@ #define MAXDSIZ (128UL*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ -#define DFLSSIZ (512UL*1024) /* initial stack size limit */ +#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ #endif #ifndef MAXSSIZ #define MAXSSIZ (64UL*1024*1024) /* max stack size */ #endif +#ifndef SGROWSIZ +#define SGROWSIZ (128UL*1024) /* amount to grow stack */ +#endif /* * Default sizes of swap allocation chunks (see dmap.h). diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index b94e92f86df..72836908ca6 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -37,7 +37,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.11 1994/02/08 09:26:04 davidg Exp $ + * $Id: vm_machdep.c,v 1.12 1994/03/07 11:38:36 davidg Exp $ */ #include "npx.h" @@ -315,8 +315,7 @@ cpu_reset() { /* * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of DFLSSIZ. It is expected (required) that there is an - * integer number of DFLSSIZ chunks in MAXSSIZ. + * chunks of SGROWSIZ. */ int grow(p, sp) @@ -336,7 +335,7 @@ grow(p, sp) return (0); if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - DFLSSIZ) < nss) { + SGROWSIZ) < nss) { int grow_amount; /* * If necessary, grow the VM that the stack occupies @@ -344,13 +343,13 @@ grow(p, sp) * to allocate all of the VM up-front in execve (which * is expensive). * Grow the VM by the amount requested rounded up to - * the nearest DFLSSIZ to provide for some hysteresis. + * the nearest SGROWSIZ to provide for some hysteresis. */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), DFLSSIZ); + grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - DFLSSIZ) - grow_amount; + SGROWSIZ) - grow_amount; /* - * If there isn't enough room to extend by DFLSSIZ, then + * If there isn't enough room to extend by SGROWSIZ, then * just extend to the maximum size */ if (v < vm->vm_maxsaddr) { diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index 95d4fc93a60..df901267202 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $Id: vmparam.h,v 1.10 1994/01/03 16:00:52 davidg Exp $ + * $Id: vmparam.h,v 1.11 1994/01/14 16:24:00 davidg Exp $ */ @@ -75,11 +75,14 @@ #define MAXDSIZ (128UL*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ -#define DFLSSIZ (512UL*1024) /* initial stack size limit */ +#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ #endif #ifndef MAXSSIZ #define MAXSSIZ (64UL*1024*1024) /* max stack size */ #endif +#ifndef SGROWSIZ +#define SGROWSIZ (128UL*1024) /* amount to grow stack */ +#endif /* * Default sizes of swap allocation chunks (see dmap.h).