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