Commit | Line | Data |
---|---|---|
5b8da473 WN |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * William Jolitz. | |
7 | * | |
8 | * %sccs.include.noredist.c% | |
9 | * | |
3ae29e61 | 10 | * @(#)vmparam.h 5.2 (Berkeley) %G% |
5b8da473 WN |
11 | */ |
12 | ||
13 | /* | |
14 | * Machine dependent constants for 386. | |
15 | */ | |
16 | ||
17 | /* | |
18 | * Virtual address space arrangement. On 386, both user and kernel | |
19 | * share the address space, not unlike the arrangements on the vax. | |
20 | * USRTEXT is the start of the user text/data space, while USRSTACK | |
21 | * is the top (end) of the user stack. Immediately above the user stack | |
22 | * resides the user structure, which is UPAGES long and contains the | |
23 | * kernel stack. As such, UPAGES is the number of pages from the beginning | |
24 | * of the P1 region to the beginning of the user stack. Also, the P0 | |
25 | * region begins with user text and ends with user data. | |
26 | * Immediately after the user structure is the kernal address space. | |
27 | */ | |
3ae29e61 | 28 | |
5b8da473 WN |
29 | #define USRTEXT 0 |
30 | #define USRSTACK 0xFDFFE000 /* Sysbase - UPAGES*NBPG */ | |
31 | #define BTOPUSRSTACK (0xFE000-(UPAGES)) /* btop(USRSTACK) */ | |
32 | ||
33 | #define P1PAGES 0xFE000 | |
34 | #define LOWPAGES 0 | |
35 | #define HIGHPAGES UPAGES | |
36 | ||
37 | /* | |
38 | * Virtual memory related constants, all in bytes | |
39 | */ | |
40 | #define MAXTSIZ (6*1024*1024) /* max text size */ | |
41 | #ifndef DFLDSIZ | |
42 | #define DFLDSIZ (6*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 (512*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 | */ | |
59 | #define DMMIN 32 /* smallest swap allocation */ | |
60 | #define DMMAX 4096 /* largest potential swap allocation */ | |
61 | #define DMTEXT 1024 /* swap allocation for text */ | |
62 | ||
63 | /* | |
64 | * Sizes of the system and user portions of the system page table. | |
65 | */ | |
66 | #define SYSPTSIZE (2*NPTEPG) | |
67 | #define USRPTSIZE (2*NPTEPG) | |
68 | ||
3ae29e61 BJ |
69 | /* |
70 | * Size of User Raw I/O map | |
71 | */ | |
72 | #define USRIOSIZE 30 | |
73 | ||
5b8da473 WN |
74 | /* |
75 | * The size of the clock loop. | |
76 | */ | |
77 | #define LOOPPAGES (maxfree - firstfree) | |
78 | ||
79 | /* | |
80 | * The time for a process to be blocked before being very swappable. | |
81 | * This is a number of seconds which the system takes as being a non-trivial | |
82 | * amount of real time. You probably shouldn't change this; | |
83 | * it is used in subtle ways (fractions and multiples of it are, that is, like | |
84 | * half of a ``long time'', almost a long time, etc.) | |
85 | * It is related to human patience and other factors which don't really | |
86 | * change over time. | |
87 | */ | |
88 | #define MAXSLP 20 | |
89 | ||
90 | /* | |
91 | * A swapped in process is given a small amount of core without being bothered | |
92 | * by the page replacement algorithm. Basically this says that if you are | |
93 | * swapped in you deserve some resources. We protect the last SAFERSS | |
94 | * pages against paging and will just swap you out rather than paging you. | |
95 | * Note that each process has at least UPAGES+CLSIZE pages which are not | |
96 | * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this | |
97 | * number just means a swapped in process is given around 25k bytes. | |
98 | * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), | |
99 | * so we loan each swapped in process memory worth 100$, or just admit | |
100 | * that we don't consider it worthwhile and swap it out to disk which costs | |
101 | * $30/mb or about $0.75. | |
102 | * { wfj 6/16/89: Retail AT memory expansion $800/megabyte, loan of $17 | |
103 | * on disk costing $7/mb or $0.18 (in memory still 100:1 in cost!) } | |
104 | */ | |
3ae29e61 | 105 | #define SAFERSS 8 /* nominal ``small'' resident set size |
5b8da473 WN |
106 | protected against replacement */ |
107 | ||
108 | /* | |
109 | * DISKRPM is used to estimate the number of paging i/o operations | |
110 | * which one can expect from a single disk controller. | |
111 | */ | |
112 | #define DISKRPM 60 | |
113 | ||
114 | /* | |
115 | * Klustering constants. Klustering is the gathering | |
116 | * of pages together for pagein/pageout, while clustering | |
117 | * is the treatment of hardware page size as though it were | |
118 | * larger than it really is. | |
119 | * | |
120 | * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) | |
121 | * units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h. | |
122 | */ | |
123 | ||
124 | #define KLMAX (4/CLSIZE) | |
125 | #define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ | |
126 | #define KLIN (4/CLSIZE) /* default data/stack in klust */ | |
127 | #define KLTXT (4/CLSIZE) /* default text in klust */ | |
128 | #define KLOUT (4/CLSIZE) | |
129 | ||
130 | /* | |
131 | * KLSDIST is the advance or retard of the fifo reclaim for sequential | |
132 | * processes data space. | |
133 | */ | |
134 | #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ | |
135 | ||
136 | /* | |
137 | * Paging thresholds (see vm_sched.c). | |
138 | * Strategy of 1/19/85: | |
139 | * lotsfree is 512k bytes, but at most 1/4 of memory | |
140 | * desfree is 200k bytes, but at most 1/8 of memory | |
141 | * minfree is 64k bytes, but at most 1/2 of desfree | |
142 | */ | |
143 | #define LOTSFREE (512 * 1024) | |
144 | #define LOTSFREEFRACT 4 | |
145 | #define DESFREE (200 * 1024) | |
146 | #define DESFREEFRACT 8 | |
147 | #define MINFREE (64 * 1024) | |
148 | #define MINFREEFRACT 2 | |
149 | ||
150 | /* | |
151 | * There are two clock hands, initially separated by HANDSPREAD bytes | |
152 | * (but at most all of user memory). The amount of time to reclaim | |
153 | * a page once the pageout process examines it increases with this | |
154 | * distance and decreases as the scan rate rises. | |
155 | */ | |
156 | #define HANDSPREAD (2 * 1024 * 1024) | |
157 | ||
158 | /* | |
159 | * The number of times per second to recompute the desired paging rate | |
160 | * and poke the pagedaemon. | |
161 | */ | |
162 | #define RATETOSCHEDPAGING 4 | |
163 | ||
164 | /* | |
165 | * Believed threshold (in megabytes) for which interleaved | |
166 | * swapping area is desirable. | |
167 | */ | |
168 | #define LOTSOFMEM 2 | |
169 | ||
170 | #define mapin(pte, v, pfnum, prot) \ | |
171 | (*(int *)(pte) = ((pfnum)<<PGSHIFT) | (prot)) | |
172 | ||
173 | /* | |
174 | * Invalidate a cluster (optimized here for standard CLSIZE). | |
175 | */ | |
176 | #if CLSIZE == 1 | |
177 | #define tbiscl(v) | |
178 | #endif | |
3ae29e61 BJ |
179 | |
180 | /* | |
181 | * Flush MMU TLB | |
182 | */ | |
183 | ||
184 | #define tlbflush() asm(" movl %cr3,%eax; movl %eax,%cr3 " /*, "ax" */) |