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 | * | |
10 | * @(#)vmparam.h 5.1 (Berkeley) %G% | |
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 | */ | |
28 | #define USRTEXT 0 | |
29 | #define USRSTACK 0xFDFFE000 /* Sysbase - UPAGES*NBPG */ | |
30 | #define BTOPUSRSTACK (0xFE000-(UPAGES)) /* btop(USRSTACK) */ | |
31 | ||
32 | #define P1PAGES 0xFE000 | |
33 | #define LOWPAGES 0 | |
34 | #define HIGHPAGES UPAGES | |
35 | ||
36 | /* | |
37 | * Virtual memory related constants, all in bytes | |
38 | */ | |
39 | #define MAXTSIZ (6*1024*1024) /* max text size */ | |
40 | #ifndef DFLDSIZ | |
41 | #define DFLDSIZ (6*1024*1024) /* initial data size limit */ | |
42 | #endif | |
43 | #ifndef MAXDSIZ | |
44 | #define MAXDSIZ (32*1024*1024) /* max data size */ | |
45 | #endif | |
46 | #ifndef DFLSSIZ | |
47 | #define DFLSSIZ (512*1024) /* initial stack size limit */ | |
48 | #endif | |
49 | #ifndef MAXSSIZ | |
50 | #define MAXSSIZ MAXDSIZ /* max stack size */ | |
51 | #endif | |
52 | ||
53 | /* | |
54 | * Default sizes of swap allocation chunks (see dmap.h). | |
55 | * The actual values may be changed in vminit() based on MAXDSIZ. | |
56 | * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. | |
57 | */ | |
58 | #define DMMIN 32 /* smallest swap allocation */ | |
59 | #define DMMAX 4096 /* largest potential swap allocation */ | |
60 | #define DMTEXT 1024 /* swap allocation for text */ | |
61 | ||
62 | /* | |
63 | * Sizes of the system and user portions of the system page table. | |
64 | */ | |
65 | #define SYSPTSIZE (2*NPTEPG) | |
66 | #define USRPTSIZE (2*NPTEPG) | |
67 | ||
68 | /* | |
69 | * The size of the clock loop. | |
70 | */ | |
71 | #define LOOPPAGES (maxfree - firstfree) | |
72 | ||
73 | /* | |
74 | * The time for a process to be blocked before being very swappable. | |
75 | * This is a number of seconds which the system takes as being a non-trivial | |
76 | * amount of real time. You probably shouldn't change this; | |
77 | * it is used in subtle ways (fractions and multiples of it are, that is, like | |
78 | * half of a ``long time'', almost a long time, etc.) | |
79 | * It is related to human patience and other factors which don't really | |
80 | * change over time. | |
81 | */ | |
82 | #define MAXSLP 20 | |
83 | ||
84 | /* | |
85 | * A swapped in process is given a small amount of core without being bothered | |
86 | * by the page replacement algorithm. Basically this says that if you are | |
87 | * swapped in you deserve some resources. We protect the last SAFERSS | |
88 | * pages against paging and will just swap you out rather than paging you. | |
89 | * Note that each process has at least UPAGES+CLSIZE pages which are not | |
90 | * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this | |
91 | * number just means a swapped in process is given around 25k bytes. | |
92 | * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), | |
93 | * so we loan each swapped in process memory worth 100$, or just admit | |
94 | * that we don't consider it worthwhile and swap it out to disk which costs | |
95 | * $30/mb or about $0.75. | |
96 | * { wfj 6/16/89: Retail AT memory expansion $800/megabyte, loan of $17 | |
97 | * on disk costing $7/mb or $0.18 (in memory still 100:1 in cost!) } | |
98 | */ | |
99 | #define SAFERSS 32 /* nominal ``small'' resident set size | |
100 | protected against replacement */ | |
101 | ||
102 | /* | |
103 | * DISKRPM is used to estimate the number of paging i/o operations | |
104 | * which one can expect from a single disk controller. | |
105 | */ | |
106 | #define DISKRPM 60 | |
107 | ||
108 | /* | |
109 | * Klustering constants. Klustering is the gathering | |
110 | * of pages together for pagein/pageout, while clustering | |
111 | * is the treatment of hardware page size as though it were | |
112 | * larger than it really is. | |
113 | * | |
114 | * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) | |
115 | * units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h. | |
116 | */ | |
117 | ||
118 | #define KLMAX (4/CLSIZE) | |
119 | #define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ | |
120 | #define KLIN (4/CLSIZE) /* default data/stack in klust */ | |
121 | #define KLTXT (4/CLSIZE) /* default text in klust */ | |
122 | #define KLOUT (4/CLSIZE) | |
123 | ||
124 | /* | |
125 | * KLSDIST is the advance or retard of the fifo reclaim for sequential | |
126 | * processes data space. | |
127 | */ | |
128 | #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ | |
129 | ||
130 | /* | |
131 | * Paging thresholds (see vm_sched.c). | |
132 | * Strategy of 1/19/85: | |
133 | * lotsfree is 512k bytes, but at most 1/4 of memory | |
134 | * desfree is 200k bytes, but at most 1/8 of memory | |
135 | * minfree is 64k bytes, but at most 1/2 of desfree | |
136 | */ | |
137 | #define LOTSFREE (512 * 1024) | |
138 | #define LOTSFREEFRACT 4 | |
139 | #define DESFREE (200 * 1024) | |
140 | #define DESFREEFRACT 8 | |
141 | #define MINFREE (64 * 1024) | |
142 | #define MINFREEFRACT 2 | |
143 | ||
144 | /* | |
145 | * There are two clock hands, initially separated by HANDSPREAD bytes | |
146 | * (but at most all of user memory). The amount of time to reclaim | |
147 | * a page once the pageout process examines it increases with this | |
148 | * distance and decreases as the scan rate rises. | |
149 | */ | |
150 | #define HANDSPREAD (2 * 1024 * 1024) | |
151 | ||
152 | /* | |
153 | * The number of times per second to recompute the desired paging rate | |
154 | * and poke the pagedaemon. | |
155 | */ | |
156 | #define RATETOSCHEDPAGING 4 | |
157 | ||
158 | /* | |
159 | * Believed threshold (in megabytes) for which interleaved | |
160 | * swapping area is desirable. | |
161 | */ | |
162 | #define LOTSOFMEM 2 | |
163 | ||
164 | #define mapin(pte, v, pfnum, prot) \ | |
165 | (*(int *)(pte) = ((pfnum)<<PGSHIFT) | (prot)) | |
166 | ||
167 | /* | |
168 | * Invalidate a cluster (optimized here for standard CLSIZE). | |
169 | */ | |
170 | #if CLSIZE == 1 | |
171 | #define tbiscl(v) | |
172 | #endif |