mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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.
This commit is contained in:
parent
66ad8173f3
commit
29360eb099
4 changed files with 24 additions and 20 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
Loading…
Reference in a new issue