1 /*- 2 * Copyright (c) 1982, 1986 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 * 7 * @(#)vmparam.h 7.4 (Berkeley) 05/08/91 8 */ 9 10 /* 11 * Machine dependent constants for VAX 12 */ 13 /* 14 * USRTEXT is the start of the user text/data space, while USRSTACK 15 * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are 16 * the number of pages from the beginning of the P0 region to the 17 * beginning of the text and from the beginning of the P1 region to the 18 * beginning of the stack respectively. 19 */ 20 #define USRTEXT 0 21 #define USRSTACK (0x80000000-UPAGES*NBPG) /* Start of user stack */ 22 #define BTOPUSRSTACK (0x400000 - UPAGES) /* btop(USRSTACK) */ 23 /* number of ptes per page */ 24 #define P1PAGES 0x200000 /* number of pages in P1 region */ 25 #define LOWPAGES 0 26 #define HIGHPAGES UPAGES 27 28 /* 29 * Virtual memory related constants, all in bytes 30 */ 31 #ifndef MAXTSIZ 32 #define MAXTSIZ (6*1024*1024) /* max text size */ 33 #endif 34 #ifndef DFLDSIZ 35 #define DFLDSIZ (6*1024*1024) /* initial data size limit */ 36 #endif 37 #ifndef MAXDSIZ 38 #define MAXDSIZ (16*1024*1024) /* max data size */ 39 #endif 40 #ifndef DFLSSIZ 41 #define DFLSSIZ (512*1024) /* initial stack size limit */ 42 #endif 43 #ifndef MAXSSIZ 44 #define MAXSSIZ MAXDSIZ /* max stack size */ 45 #endif 46 47 /* 48 * Default sizes of swap allocation chunks (see dmap.h). 49 * The actual values may be changed in vminit() based on MAXDSIZ. 50 * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. 51 * DMMIN should be at least ctod(1) so that vtod() works. 52 * vminit() ensures this. 53 */ 54 #define DMMIN 32 /* smallest swap allocation */ 55 #define DMMAX 4096 /* largest potential swap allocation */ 56 #define DMTEXT 1024 /* swap allocation for text */ 57 58 /* 59 * Sizes of the system and user portions of the system page table. 60 */ 61 /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ 62 #define SYSPTSIZE ((20+MAXUSERS)*NPTEPG) 63 #define USRPTSIZE (32*NPTEPG) 64 65 /* 66 * PTEs for system V compatible shared memory. 67 * This is basically slop for kmempt which we actually allocate (malloc) from. 68 */ 69 #define SHMMAXPGS 1024 70 71 /* 72 * Boundary at which to place first MAPMEM segment if not explicitly 73 * specified. Should be a power of two. This allows some slop for 74 * the data segment to grow underneath the first mapped segment. 75 */ 76 #define MMSEG 0x200000 77 78 /* 79 * The size of the clock loop. 80 */ 81 #define LOOPPAGES (maxfree - firstfree) 82 83 /* 84 * The time for a process to be blocked before being very swappable. 85 * This is a number of seconds which the system takes as being a non-trivial 86 * amount of real time. You probably shouldn't change this; 87 * it is used in subtle ways (fractions and multiples of it are, that is, like 88 * half of a ``long time'', almost a long time, etc.) 89 * It is related to human patience and other factors which don't really 90 * change over time. 91 */ 92 #define MAXSLP 20 93 94 /* 95 * A swapped in process is given a small amount of core without being bothered 96 * by the page replacement algorithm. Basically this says that if you are 97 * swapped in you deserve some resources. We protect the last SAFERSS 98 * pages against paging and will just swap you out rather than paging you. 99 * Note that each process has at least UPAGES+CLSIZE pages which are not 100 * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this 101 * number just means a swapped in process is given around 25k bytes. 102 * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), 103 * so we loan each swapped in process memory worth 100$, or just admit 104 * that we don't consider it worthwhile and swap it out to disk which costs 105 * $30/mb or about $0.75. 106 */ 107 #define SAFERSS 32 /* nominal ``small'' resident set size 108 protected against replacement */ 109 110 /* 111 * DISKRPM is used to estimate the number of paging i/o operations 112 * which one can expect from a single disk controller. 113 */ 114 #define DISKRPM 60 115 116 /* 117 * Klustering constants. Klustering is the gathering 118 * of pages together for pagein/pageout, while clustering 119 * is the treatment of hardware page size as though it were 120 * larger than it really is. 121 * 122 * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) 123 * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. 124 * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) to 125 * avoid "big push" panics. 126 */ 127 128 #define KLMAX (32/CLSIZE) 129 #define KLSEQL (16/CLSIZE) /* in klust if vadvise(VA_SEQL) */ 130 #define KLIN (8/CLSIZE) /* default data/stack in klust */ 131 #define KLTXT (4/CLSIZE) /* default text in klust */ 132 #define KLOUT (32/CLSIZE) 133 134 /* 135 * KLSDIST is the advance or retard of the fifo reclaim for sequential 136 * processes data space. 137 */ 138 #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ 139 140 /* 141 * Paging thresholds (see vm_sched.c). 142 * Strategy of 1/19/85: 143 * lotsfree is 512k bytes, but at most 1/4 of memory 144 * desfree is 200k bytes, but at most 1/8 of memory 145 * minfree is 64k bytes, but at most 1/2 of desfree 146 */ 147 #define LOTSFREE (512 * 1024) 148 #define LOTSFREEFRACT 4 149 #define DESFREE (200 * 1024) 150 #define DESFREEFRACT 8 151 #define MINFREE (64 * 1024) 152 #define MINFREEFRACT 2 153 154 /* 155 * There are two clock hands, initially separated by HANDSPREAD bytes 156 * (but at most all of user memory). The amount of time to reclaim 157 * a page once the pageout process examines it increases with this 158 * distance and decreases as the scan rate rises. 159 */ 160 #define HANDSPREAD (2 * 1024 * 1024) 161 162 /* 163 * The number of times per second to recompute the desired paging rate 164 * and poke the pagedaemon. 165 */ 166 #define RATETOSCHEDPAGING 4 167 168 /* 169 * Believed threshold (in megabytes) for which interleaved 170 * swapping area is desirable. 171 */ 172 #define LOTSOFMEM 2 173 174 #define mapin(pte, v, pfnum, prot) \ 175 (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, v)) 176