1*52131Smckusick /* 2*52131Smckusick * Copyright (c) 1988 University of Utah. 3*52131Smckusick * Copyright (c) 1992 The Regents of the University of California. 4*52131Smckusick * All rights reserved. 5*52131Smckusick * 6*52131Smckusick * This code is derived from software contributed to Berkeley by 7*52131Smckusick * the Systems Programming Group of the University of Utah Computer 8*52131Smckusick * Science Department and Ralph Campbell. 9*52131Smckusick * 10*52131Smckusick * %sccs.include.redist.c% 11*52131Smckusick * 12*52131Smckusick * from: Utah $Hdr: vmparam.h 1.16 91/01/18$ 13*52131Smckusick * 14*52131Smckusick * @(#)vmparam.h 7.1 (Berkeley) 01/07/92 15*52131Smckusick */ 16*52131Smckusick 17*52131Smckusick /* 18*52131Smckusick * Machine dependent constants for DEC Station 3100. 19*52131Smckusick */ 20*52131Smckusick /* 21*52131Smckusick * USRTEXT is the start of the user text/data space, while USRSTACK 22*52131Smckusick * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are 23*52131Smckusick * the number of pages from the beginning of the P0 region to the 24*52131Smckusick * beginning of the text and from the beginning of the P1 region to the 25*52131Smckusick * beginning of the stack respectively. 26*52131Smckusick */ 27*52131Smckusick #define USRTEXT 0x00400000 28*52131Smckusick #define USRDATA 0x10000000 29*52131Smckusick #define USRSTACK 0x80000000 /* Start of user stack */ 30*52131Smckusick #define BTOPUSRSTACK 0x80000 /* btop(USRSTACK) */ 31*52131Smckusick #define LOWPAGES 0x00400 32*52131Smckusick #define MIDPAGES 0x10000 33*52131Smckusick #define HIGHPAGES 0 34*52131Smckusick 35*52131Smckusick /* 36*52131Smckusick * Virtual memory related constants, all in bytes 37*52131Smckusick */ 38*52131Smckusick #ifndef MAXTSIZ 39*52131Smckusick #define MAXTSIZ (24*1024*1024) /* max text size */ 40*52131Smckusick #endif 41*52131Smckusick #ifndef DFLDSIZ 42*52131Smckusick #define DFLDSIZ (32*1024*1024) /* initial data size limit */ 43*52131Smckusick #endif 44*52131Smckusick #ifndef MAXDSIZ 45*52131Smckusick #define MAXDSIZ (32*1024*1024) /* max data size */ 46*52131Smckusick #endif 47*52131Smckusick #ifndef DFLSSIZ 48*52131Smckusick #define DFLSSIZ (1024*1024) /* initial stack size limit */ 49*52131Smckusick #endif 50*52131Smckusick #ifndef MAXSSIZ 51*52131Smckusick #define MAXSSIZ MAXDSIZ /* max stack size */ 52*52131Smckusick #endif 53*52131Smckusick 54*52131Smckusick /* 55*52131Smckusick * Default sizes of swap allocation chunks (see dmap.h). 56*52131Smckusick * The actual values may be changed in vminit() based on MAXDSIZ. 57*52131Smckusick * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 58*52131Smckusick * DMMIN should be at least ctod(1) so that vtod() works. 59*52131Smckusick * vminit() insures this. 60*52131Smckusick */ 61*52131Smckusick #define DMMIN 32 /* smallest swap allocation */ 62*52131Smckusick #define DMMAX 4096 /* largest potential swap allocation */ 63*52131Smckusick 64*52131Smckusick /* 65*52131Smckusick * Sizes of the system and user portions of the system page table. 66*52131Smckusick */ 67*52131Smckusick /* SYSPTSIZE IS SILLY; (really number of buffers for I/O) */ 68*52131Smckusick #define SYSPTSIZE 1228 69*52131Smckusick #define USRPTSIZE 1024 70*52131Smckusick 71*52131Smckusick /* 72*52131Smckusick * PTEs for mapping user space into the kernel for phyio operations. 73*52131Smckusick * 16 pte's are enough to cover 8 disks * MAXBSIZE. 74*52131Smckusick */ 75*52131Smckusick #ifndef USRIOSIZE 76*52131Smckusick #define USRIOSIZE 32 77*52131Smckusick #endif 78*52131Smckusick 79*52131Smckusick /* 80*52131Smckusick * PTEs for system V style shared memory. 81*52131Smckusick * This is basically slop for kmempt which we actually allocate (malloc) from. 82*52131Smckusick */ 83*52131Smckusick #ifndef SHMMAXPGS 84*52131Smckusick #define SHMMAXPGS 1024 /* 4mb */ 85*52131Smckusick #endif 86*52131Smckusick 87*52131Smckusick /* 88*52131Smckusick * Boundary at which to place first MAPMEM segment if not explicitly 89*52131Smckusick * specified. Should be a power of two. This allows some slop for 90*52131Smckusick * the data segment to grow underneath the first mapped segment. 91*52131Smckusick */ 92*52131Smckusick #define MMSEG 0x200000 93*52131Smckusick 94*52131Smckusick /* 95*52131Smckusick * The size of the clock loop. 96*52131Smckusick */ 97*52131Smckusick #define LOOPPAGES (maxfree - firstfree) 98*52131Smckusick 99*52131Smckusick /* 100*52131Smckusick * The time for a process to be blocked before being very swappable. 101*52131Smckusick * This is a number of seconds which the system takes as being a non-trivial 102*52131Smckusick * amount of real time. You probably shouldn't change this; 103*52131Smckusick * it is used in subtle ways (fractions and multiples of it are, that is, like 104*52131Smckusick * half of a ``long time'', almost a long time, etc.) 105*52131Smckusick * It is related to human patience and other factors which don't really 106*52131Smckusick * change over time. 107*52131Smckusick */ 108*52131Smckusick #define MAXSLP 20 109*52131Smckusick 110*52131Smckusick /* 111*52131Smckusick * A swapped in process is given a small amount of core without being bothered 112*52131Smckusick * by the page replacement algorithm. Basically this says that if you are 113*52131Smckusick * swapped in you deserve some resources. We protect the last SAFERSS 114*52131Smckusick * pages against paging and will just swap you out rather than paging you. 115*52131Smckusick * Note that each process has at least UPAGES+CLSIZE pages which are not 116*52131Smckusick * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 117*52131Smckusick * number just means a swapped in process is given around 25k bytes. 118*52131Smckusick * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 119*52131Smckusick * so we loan each swapped in process memory worth 100$, or just admit 120*52131Smckusick * that we don't consider it worthwhile and swap it out to disk which costs 121*52131Smckusick * $30/mb or about $0.75. 122*52131Smckusick */ 123*52131Smckusick #define SAFERSS 4 /* nominal ``small'' resident set size 124*52131Smckusick protected against replacement */ 125*52131Smckusick 126*52131Smckusick /* 127*52131Smckusick * DISKRPM is used to estimate the number of paging i/o operations 128*52131Smckusick * which one can expect from a single disk controller. 129*52131Smckusick */ 130*52131Smckusick #define DISKRPM 60 131*52131Smckusick 132*52131Smckusick /* 133*52131Smckusick * Klustering constants. Klustering is the gathering 134*52131Smckusick * of pages together for pagein/pageout, while clustering 135*52131Smckusick * is the treatment of hardware page size as though it were 136*52131Smckusick * larger than it really is. 137*52131Smckusick * 138*52131Smckusick * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 139*52131Smckusick * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. 140*52131Smckusick * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) 141*52131Smckusick * unless you like "big push" panics. 142*52131Smckusick */ 143*52131Smckusick 144*52131Smckusick #ifdef notdef /* XXX */ 145*52131Smckusick #define KLMAX (4/CLSIZE) 146*52131Smckusick #define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 147*52131Smckusick #define KLIN (4/CLSIZE) /* default data/stack in klust */ 148*52131Smckusick #define KLTXT (4/CLSIZE) /* default text in klust */ 149*52131Smckusick #define KLOUT (4/CLSIZE) 150*52131Smckusick #else 151*52131Smckusick #define KLMAX (1/CLSIZE) 152*52131Smckusick #define KLSEQL (1/CLSIZE) 153*52131Smckusick #define KLIN (1/CLSIZE) 154*52131Smckusick #define KLTXT (1/CLSIZE) 155*52131Smckusick #define KLOUT (1/CLSIZE) 156*52131Smckusick #endif 157*52131Smckusick 158*52131Smckusick /* 159*52131Smckusick * KLSDIST is the advance or retard of the fifo reclaim for sequential 160*52131Smckusick * processes data space. 161*52131Smckusick */ 162*52131Smckusick #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 163*52131Smckusick 164*52131Smckusick /* 165*52131Smckusick * Paging thresholds (see vm_sched.c). 166*52131Smckusick * Strategy of 1/19/85: 167*52131Smckusick * lotsfree is 512k bytes, but at most 1/4 of memory 168*52131Smckusick * desfree is 200k bytes, but at most 1/8 of memory 169*52131Smckusick * minfree is 64k bytes, but at most 1/2 of desfree 170*52131Smckusick */ 171*52131Smckusick #define LOTSFREE (512 * 1024) 172*52131Smckusick #define LOTSFREEFRACT 4 173*52131Smckusick #define DESFREE (200 * 1024) 174*52131Smckusick #define DESFREEFRACT 8 175*52131Smckusick #define MINFREE (64 * 1024) 176*52131Smckusick #define MINFREEFRACT 2 177*52131Smckusick 178*52131Smckusick /* 179*52131Smckusick * There are two clock hands, initially separated by HANDSPREAD bytes 180*52131Smckusick * (but at most all of user memory). The amount of time to reclaim 181*52131Smckusick * a page once the pageout process examines it increases with this 182*52131Smckusick * distance and decreases as the scan rate rises. 183*52131Smckusick */ 184*52131Smckusick #define HANDSPREAD (2 * 1024 * 1024) 185*52131Smckusick 186*52131Smckusick /* 187*52131Smckusick * The number of times per second to recompute the desired paging rate 188*52131Smckusick * and poke the pagedaemon. 189*52131Smckusick */ 190*52131Smckusick #define RATETOSCHEDPAGING 4 191*52131Smckusick 192*52131Smckusick /* 193*52131Smckusick * Believed threshold (in megabytes) for which interleaved 194*52131Smckusick * swapping area is desirable. 195*52131Smckusick */ 196*52131Smckusick #define LOTSOFMEM 2 197*52131Smckusick 198*52131Smckusick #define mapin(pte, v, pfnum, prot) \ 199*52131Smckusick (*(int *)(pte) = ((pfnum) << PG_SHIFT) | (prot), MachTLBFlushAddr(v)) 200*52131Smckusick 201*52131Smckusick /* 202*52131Smckusick * Mach derived constants 203*52131Smckusick */ 204*52131Smckusick 205*52131Smckusick /* user/kernel map constants */ 206*52131Smckusick #define VM_MIN_ADDRESS ((vm_offset_t)0) 207*52131Smckusick #define VM_MAXUSER_ADDRESS ((vm_offset_t)0x80000000) 208*52131Smckusick #define VM_MAX_ADDRESS ((vm_offset_t)0x80000000) 209*52131Smckusick #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xC0000000) 210*52131Smckusick #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFFFFC000) 211*52131Smckusick 212*52131Smckusick /* virtual sizes (bytes) for various kernel submaps */ 213*52131Smckusick #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) 214*52131Smckusick #define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) 215*52131Smckusick #define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) 216*52131Smckusick 217*52131Smckusick /* pcb base */ 218*52131Smckusick #define pcbb(p) ((u_int)(p)->p_addr) 219