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