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